Arturus / kaggle-web-traffic

1st place solution
MIT License
1.82k stars 667 forks source link

AttributeError: "NoneType' object has no attribute 'set_index' #7

Closed ndhuanhuan closed 6 years ago

ndhuanhuan commented 6 years ago

When I execute "python make_features.py data/vars --add_days=63", I got following error:

Traceback (most recent call last): File "make_features.py", line 349, in run() File "make_features.py", line 273, in run df, nans, starts, ends = prepare_data(args.start, args.end, args.valid_thres hold) File "make_features.py", line 176, in prepare_data df = read_x(start, end) File "make_features.py", line 75, in read_x df = read_all() File "make_features.py", line 48, in read_all scraped = read_file('2017-08-15_2017-09-11_new') File "make_features.py", line 36, in read_file df = read_cached(file).set_index('Page') AttributeError: 'NoneType' object has no attribute 'set_index'

I'm using Python 3.6.3, pandas 0.22.0. Thanks!

Arturus commented 6 years ago

Seems like read_cached() can't read the file and returns None. Please check that you have ''2017-08-15_2017-09-11_new'' in a right place, you can also try to delete cached .pkl file (it will be recreated on next run)

xiaoyu-wu commented 6 years ago

I renamed the file "2017-08-15_2017-09-11.csv.zip" to "2017-08-15_2017-09-11_new.csv.zip" and the feature-making step works fine now.

ndhuanhuan commented 6 years ago

@xiaoyu-wu, I renamed it and it works now. Thanks!

Arturus commented 6 years ago

Fixed make_features.py, it was my mistake - I had cached 2017-08-15_2017-09-11_new.pkl file in a working directory. Thank you for bugreport!