码迷,mamicode.com
首页 > 其他好文 > 详细

读取pandas修改单列数据类型

时间:2016-11-11 12:02:08      阅读:333      评论:0      收藏:0      [点我收藏+]

标签:and   color   nump   encoding   imp   span   oat   style   nbsp   

import pandas as pd
import numpy as np

df = pd.read_csv(‘000917.csv‘,encoding=‘gbk‘)
df = df[df[‘涨跌幅‘]!=‘None‘]
df[‘涨跌幅‘] = df[‘涨跌幅‘].astype(np.float64)

print(df[df[‘涨跌幅‘]>5])

 

读取pandas修改单列数据类型

标签:and   color   nump   encoding   imp   span   oat   style   nbsp   

原文地址:http://www.cnblogs.com/wumac/p/6053602.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!