生成行为序列特征...
预处理失败: Length mismatch: Expected axis has 1 elements, new values have 6 elements
C:\Users\Lenovo\AppData\Local\Temp\ipykernel_20948\3356220079.py:91: FutureWarning: A value is trying to be set on a copy of a DataFrame or Series through chained assignment using an inplace method.
The behavior will change in pandas 3.0. This inplace method will never work because the intermediate object on which we are setting values always behaves as a copy.
For example, when doing 'df[col].method(value, inplace=True)', try using 'df.method({col: value}, inplace=True)' or df[col] = df[col].method(value) instead, to perform the operation inplace on the original object.
user_df['user_geohash'].fillna('unknown', inplace=True)
C:\Users\Lenovo\AppData\Local\Temp\ipykernel_20948\3356220079.py:91: SettingWithCopyWarning:
A value is trying to be set on a copy of a slice from a DataFrame
See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
user_df['user_geohash'].fillna('unknown', inplace=True)
Traceback (most recent call last):
File "C:\Users\Lenovo\AppData\Local\Temp\ipykernel_20948\3356220079.py", line 215, in preprocess_data
user_df = generate_behavior_features(user_df)
File "C:\Users\Lenovo\AppData\Local\Temp\ipykernel_20948\3356220079.py", line 147, in generate_behavior_features
user_item_stats.columns = ['user_id', 'item_id', 'pv', 'cart', 'fav', 'buy']
^^^^^^^^^^^^^^^^^^^^^^^
File "E:\python\Lib\site-packages\pandas\core\generic.py", line 6335, in __setattr__
return object.__setattr__(self, name, value)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
File "pandas/_libs/properties.pyx", line 69, in pandas._libs.properties.AxisProperty.__set__
File "E:\python\Lib\site-packages\pandas\core\generic.py", line 817, in _set_axis
self._mgr.set_axis(axis, labels)
~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^
File "E:\python\Lib\site-packages\pandas\core\internals\managers.py", line 238, in set_axis
self._validate_set_axis(axis, new_labels)
~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^
File "E:\python\Lib\site-packages\pandas\core\internals\base.py", line 98, in _validate_set_axis
raise ValueError(
...<2 lines>...
)
ValueError: Length mismatch: Expected axis has 1 elements, new values have 6 elements
最新发布