-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Python API produces a datatype error for pandas sparse data structures #2143
Comments
@drkarthi |
Hmm, seems that this is pandas version-specific issue:
|
Looks like this was changed in pandas v0.24.0: https://github.com/pandas-dev/pandas/blob/v0.24.2/pandas/core/arrays/sparse.py#L505-L1770 |
The discussion around the breaking change in the implementation of SparseArray: pandas-dev/pandas#21978 (comment) |
@drkarthi Thank you very much for useful info! I see you have dug into the |
Sure! |
@StrikerRUS could we close this issue? |
@guolinke I think we can update pandas mapper:
|
Environment info
Operating System: OSx 10.13.6
CPU/GPU model:
C++/Python/R version: Python 3.7.3
LightGBM version or commit hash: 2.2.3
Error message
*** ValueError: DataFrame.dtypes for data must be int, float or bool.
Did not expect the data types in fields ORIGINAL_LANGUAGE_Arabic, ORIGINAL_LANGUAGE_English, ...
Reproducible examples
import lightgbm as lgb
X = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD'))
y = pd.Series(np.random.randint(0,100,size=(100)))
sX = X.to_sparse()
model_lgbm = lgb.LGBMClassifier()
model_lgbm.fit(sX, y)
Steps to reproduce
Sparse[int64, nan]
, which is not included in PANDAS_DTYPE_MAPPER.The text was updated successfully, but these errors were encountered: