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
BUG: modin.pandas.pivot_table raises ValueError when given pandas dataframe argument #6243
Comments
@zulee1711 thanks for the contribution! At the moment, Pandas objects are specifically not accepted by Modin. For this code to work, you need to explicitly convert Pandas' dataframe to Modin's dataframe like that: mpd.pivot_table(mpd.DataFrame(df), index = df.index, columns = ['ticker']) @modin-project/modin-core there are more and more situations where it would be convenient for users to pass pandas objects to Modin functions. We should rethink this. |
I think what we should do is to make a more describable error message in these situations, something like: "you're trying to pass pandas object to a modin's method, please make the conversion as follows...". It could be a real pain to efficiently support both pandas and modin objects, so my vote here is only to make clear errors. |
+1
We don't have to make the case with pandas dataframes fast (just give a warning that dataframe conversion takes time and if you want performance boost, you need to rewrite the code). Here it is more important to ensure seamless integration with other libraries, where the user does not have the ability to change imports. |
@anmyachev Thank you
A more detailed message is much appreciated. Since the error gave a warning in <class 'pandas.core.frame.DataFrame'>, I would know that there's something wrong with the code related to pandas dataframe, but wouldn't necessarily know where to look for an answer |
UPD: Even using Modin objects, I see the following error on latest master.
|
Modin version checks
I have checked that this issue has not already been reported.
I have confirmed this bug exists on the latest released version of Modin.
I have confirmed this bug exists on the main branch of Modin. (In order to do this you can follow this guide.)
Reproducible Example
Issue Description
When using pivot tables with modin, appear ValueError: can not create pivot table with instance of type <class 'pandas.core.frame.DataFrame'>
The regular Pandas works fine. Can anyone help me please?
Expected Behavior
df1 = pd.pivot_table(df, index = df.index, columns = ['ticker'])
Error Logs
Installed Versions
INSTALLED VERSIONS
commit : e8093ba372f9adfe79439d90fe74b0b5b6dea9d6
python : 3.8.10.final.0
python-bits : 64
OS : Windows
OS-release : 10
Version : 10.0.22621
machine : AMD64
processor : Intel64 Family 6 Model 167 Stepping 1, GenuineIntel
byteorder : little
LC_ALL : None
LANG : None
LOCALE : English_United States.1252
pandas : 1.4.3
numpy : 1.23.5
pytz : 2022.7.1
dateutil : 2.8.2
setuptools : 67.6.1
pip : 23.1.2
Cython : 0.29.32
pytest : 7.1.3
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : 3.0.9
lxml.etree : 4.9.1
html5lib : 1.1
pymysql : None
psycopg2 : 2.9.3
jinja2 : 3.1.2
IPython : 8.4.0
pandas_datareader: 0.10.0
bs4 : 4.11.1
bottleneck : None
brotli : 1.0.9
fastparquet : None
fsspec : 2022.8.2
gcsfs : None
markupsafe : 2.1.1
matplotlib : 3.5.3
numba : 0.56.2
numexpr : None
odfpy : None
openpyxl : 3.0.9
pandas_gbq : None
pyarrow : 6.0.1
pyreadstat : None
pyxlsb : None
s3fs : None
scipy : 1.9.3
snappy : None
sqlalchemy : 1.4.31
tables : None
tabulate : 0.8.7
xarray : None
xlrd : None
xlwt : None
zstandard : None
The text was updated successfully, but these errors were encountered: