Skip to content
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

itables causes FutureWarning for using deprecated pandas syntax in pandas 1.5 #107

Closed
sjdemartini opened this issue Nov 2, 2022 · 4 comments

Comments

@sjdemartini
Copy link

When using itables with pandas 1.5 for certain types of data in dataframes, it emits a FutureWarning due to using now-deprecated .iloc[] operations (https://pandas.pydata.org/pandas-docs/stable/whatsnew/v1.5.0.html#inplace-operation-when-setting-values-with-loc-and-iloc).

Example reproduction:

import pandas as pd
import itables

df = pd.DataFrame({ 'timestamps': pd.date_range('now', periods=5, freq='S') })
itables.show(df)

results in:

/path/to/site-packages/itables/javascript.py:118: FutureWarning: In a future version, df.iloc[:, i] = newvals will attempt to set the values inplace instead of always setting a new array. To retain the old behavior, use either df[df.columns[i]] = newvals or, if columns are non-unique, df.isetitem(i, newvals)
formatted_df.iloc[:, j] = np.array(fmt.format_array(x.values, None))


Recently discovered this great library and find it super handy right out of the box. Appreciate you releasing it, as well as any improvements!

@mwouts
Copy link
Owner

mwouts commented Nov 5, 2022

Hey @sjdemartini , thanks for reporting this! I will have a look soon.

@mwouts
Copy link
Owner

mwouts commented Nov 6, 2022

This should be fixed in itables==1.3.2. Please give it a try and confirm that everything looks right! Thanks

@mwouts mwouts closed this as completed Nov 7, 2022
@sjdemartini
Copy link
Author

Awesome, thank you for the super fast turnaround! Confirmed that this is fixed for me (using 1.3.4) 👍

@mwouts
Copy link
Owner

mwouts commented Nov 12, 2022

You're welcome! Thank you also for reporting this.

Also I wanted to mention the 'fix' above did introduce a few regressions (#112 for instance). These regressions were fixed in itables==1.3.5, which by the way has much better support for large tables.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants