带有asfreq的TypeError(BDay())。count - 使用所有列数据?

时间:2017-06-29 18:55:01

标签: python pandas

尝试查找某个范围内的工作日计数。所以,这就是我所拥有的

df['ENTRYDATE'] = pd.to_datetime(df['ENTRYDATE'], errors='coerce')
df['REQDATE'] = pd.to_datetime(df['REQDATE'], errors='coerce')
df['DELDATE'] = pd.to_datetime(df['DELDATE'], errors='coerce')
df['SHIPCONFIRMED'] = pd.to_datetime(df['SHIPCONFIRMED'], errors='coerce')
#df['DAYSLATE'] = df['DELDATE'] - df['REQDATE']
req_date = df['REQDATE']
del_date = df['DELDATE']
df['DAYSLATE'] = df.ix[req_date:del_date].asfreq(BDay()).count()

但是我得到TypeError它看起来像是在整个列中读取,而不是只处理该行中的数据。

TypeError: '['2017-05-26T00:00:00.000000000' '2017-05-04T00:00:00.000000000' '2017-05-22T00:00:00.000000000' '2017-05-12T00:00:00.000000000' '2017-05-12T00:00:00.000000000' '2017-05-16T00:00:00.000000000' '2017-04-27T00:00:00.000000000' '2017-05-26T00:00:00.000000000' ... ... '2017-05-18T00:00:00.000000000' '2017-05-29T00:00:00.000000000' '2017-05-02T00:00:00.000000000' '2017-05-02T00:00:00.000000000' '2017-05-17T00:00:00.000000000' '2017-04-28T00:00:00.000000000']' is an invalid key

感谢任何帮助或指导。

0 个答案:

没有答案