我将 Series 强制转换为 dtype = datetime64[ns]
的日期时间列(尽管只需要日分辨率... ... 不知道如何更改)。
import pandas as pd
df = pd.read_csv('somefile.csv')
column = df['date']
column = pd.to_datetime(column, coerce=True)
但密谋是行不通的:
ipdb> column.plot(kind='hist')
*** TypeError: ufunc add cannot use operands with types dtype('<M8[ns]') and dtype('float64')
我想绘制一个只有 显示按周、月或年分列的日期计数的直方图。
在 pandas
中肯定有办法做到这一点吧?