cannot convert the series to <class 'int'> - Printable Version +- Python Forum (https://python-forum.io) +-- Forum: Python Coding (https://python-forum.io/forum-7.html) +--- Forum: Data Science (https://python-forum.io/forum-44.html) +--- Thread: cannot convert the series to <class 'int'> (/thread-13747.html) |
cannot convert the series to <class 'int'> - giancastro - Oct-30-2018 Hello, Can someone help me to solve this error? df_sellout['DateTime'].head(10)
def data_class(y): bins_name=[dt.datetime(day=20,month=1,year=y),dt.datetime(day=19,month=2,year=y), dt.datetime(day=20,month=3,year=y),dt.datetime(day=19,month=4,year=y), dt.datetime(day=20,month=5,year=y),dt.datetime(day=19,month=6,year=y), dt.datetime(day=20,month=7,year=y),dt.datetime(day=19,month=8,year=y), dt.datetime(day=20,month=9,year=y),dt.datetime(day=19,month=10,year=y), dt.datetime(day=20,month=11,year=y),dt.datetime(day=19,month=12,year=y), dt.datetime(day=20,month=1,year=y+1) ] return bins_name labels_name=['jan','feb','mar','apr','mai','jun','jul','aug', 'sep','oct','nov','dec'] df_sellout['data_periodo'] = pd.cut(df_sellout['DateTime'],bins=data_class(df_sellout['DateTime'].dt.year),labels=labels_name)
RE: cannot convert the series to <class 'int'> - giancastro - Nov-05-2018 Anyone can help me? |