In my dataframe named dfwiki, I have a column of elevation data(in mm) of countries from global mean sea level. I have a linear regression model which predicted the 'time since epoch', when the elevation will be 10 metres for respective countries.
expected_submerging = regr.predict(a)
here, 'a' was the elevation in mm.
type(expected_submerging) #It is numpy.ndarray conataining epoch values
I want to attach this "expected_submerging" array back to my dataframe "dfwiki" as a column "Prediction", but in datetime format, not in epoch time in which it is now. To be clear:
expected_submerging[:10]
gives:
array([[1.74646146e+13],
[6.56033448e+12],
[7.41266564e+12],
[1.84929707e+13],
[1.03031800e+13],
[2.13093693e+13],
[5.51344947e+12],
[1.66030190e+13],
[3.05836516e+12],
[8.43175724e+12]])
On trying dfwiki["predictions"]=(pd.to_datetime(expected_submerging,unit='s'))
I get the following error:
ValueError: Buffer has wrong number of dimensions (expected 1, got 2)
On trying
ticks = expected_submerging.astype('datetime64[s]').tolist()
dfwiki["predictions"]=(pd.to_datetime(ticks,unit='s'))
I get the following error:
TypeError: unhashable type: 'list'