I use to_json
method to serialize my dataframe, the content is look like this:
"1467065160244362165":"1985.875","1467065161029130301":"1985.875","1467065161481601498":"1985.875","1467065161486508221":"1985.875"
How do I stop the read_json method convert my epoch value from 1467065160244362165
to something like 2016-06-28 06:57:23.786726222
.
This is how i call read_json:
data = pd.read_json(remote_result_fullpath, convert_dates=False)
For me works:
import pandas as pd
#added {} to file
remote_result_fullpath = 'https://dl.dropboxusercontent.com/u/84444599/file.json'
data = pd.read_json(remote_result_fullpath,
convert_dates=False, #dont convert columns to dates
convert_axes=False, #dont convert index to dates
typ='series') #if need convert output to Series
print (data)
1467065160244362165 1985.875
1467065161029130301 1985.875
1467065161481601498 1985.875
1467065161486508221 1985.875
print (data.dtypes)
dtype: float64
float64
If need strings add dtype
:
data = pd.read_json(remote_result_fullpath,
convert_dates=False,
convert_axes=False,
typ='series',
dtype='object')
print (data)
1467065160244362165 1985.875
1467065161029130301 1985.875
1467065161481601498 1985.875
1467065161486508221 1985.875
print (data.dtypes)
dtype: object
object
print (data.index)
Index(['1467065160244362165', '1467065161029130301', '1467065161481601498',
'1467065161486508221'],
dtype='object')
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With