![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
study_pandas
richard_18
这个作者很懒,什么都没留下…
展开
-
改变pandas中日期格式 pandas change datetime format
对于已经是datetime格式的 x1 x1 = pd.to_datetime( market.DATE, format=”%Y-%m-%d-%H-%M-%S”) x1 = x1.dt.strftime(‘%m/%d/%Y’)source:https://stackoverflow.com/questions/38067704/how-to-change-the-datetime-form...原创 2018-06-17 16:51:53 · 22674 阅读 · 2 评论 -
pandas string格式转成int,float
如果y1的 amount列是string格式的 y1 = pd.to_numeric(y1.amount, errors=’ignore’ )/10000errors=’coerce’, 会返回nan,these errors will be ignoredand pandas will convert problematic elements to pd.NaT (errors=’ig...原创 2018-06-17 16:58:38 · 28455 阅读 · 1 评论 -
python pandas 中datetime和string互相转化
1,string变成datetime格式 dates = pd.to_datetime(pd.Series([‘20010101’, ‘20010331’]), format = ‘%Y%m%d’) 2,datetime变回string格式 dates.apply(lambda x: x.strftime(‘%Y-%m-%d’))source: https://stackoverfl...原创 2018-06-17 20:01:49 · 62600 阅读 · 1 评论