import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
from datetime import datetime
plt.style.use('ggplot')
columns = ['user_id','order_dt','order_products','order_amount']
df = pd.read_csv('CDNOW_master.txt',names = columns,sep = 's+')
df['order_date'] = pd.to_datetime(df.order_dt,format='%Y%m%d')
df['month'] = df.order_date.values.astype('datetime64[M]')
f = df.groupby('user_id')['month'].min().value_counts()
print(f)
Above is my code,my purpose is to get the value_counts of the users purchased in their first month, but only got the result of 'NoneType' object has no attribute 'fileno'.
any ideas? much appreciate
here are the traceback
Traceback (most recent call last):
File "C:UsersAdministratorDesktoppracticeCDNOW.py", line 19, in <module>
print(f)
File "C:UsersAdministratorAppDataLocalProgramsPythonPython35libsite-packagespandascorease.py", line 51, in __str__
return self.__unicode__()
File "C:UsersAdministratorAppDataLocalProgramsPythonPython35libsite-packagespandascoreseries.py", line 982, in __unicode__
width, height = get_terminal_size()
File "C:UsersAdministratorAppDataLocalProgramsPythonPython35libsite-packagespandasioformatserminal.py", line 33, in get_terminal_size
return shutil.get_terminal_size()
File "C:UsersAdministratorAppDataLocalProgramsPythonPython35libshutil.py", line 1071, in get_terminal_size
size = os.get_terminal_size(sys.__stdout__.fileno())
AttributeError: 'NoneType' object has no attribute 'fileno'
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…