Bry*_*Fok 7 string datetime json dataframe pandas
我使用to_json方法来序列化我的数据帧,内容如下所示:
"1467065160244362165":"1985.875","1467065161029130301":"1985.875","1467065161481601498":"1985.875","1467065161486508221":"1985.875"
Run Code Online (Sandbox Code Playgroud)
如何停止的read_json方法转换从我的时代价值1467065160244362165的东西一样2016-06-28 06:57:23.786726222。这就是我调用 read_json 的方式:
data = pd.read_json(remote_result_fullpath, convert_dates=False)
Run Code Online (Sandbox Code Playgroud)
对我来说有效:
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
Run Code Online (Sandbox Code Playgroud)
如果需要字符串添加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')
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2404 次 |
| 最近记录: |