Skip to content

Some newer version of Pandas throws warnings #1061

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

Closed
gdementen opened this issue Mar 14, 2023 · 3 comments
Closed

Some newer version of Pandas throws warnings #1061

gdementen opened this issue Mar 14, 2023 · 3 comments
Assignees
Milestone

Comments

@gdementen
Copy link
Contributor

gdementen commented Mar 14, 2023

When running moses_git\rework2022\src\main.py with my updated environment (larray 0.34 et al), I get the following warning:

[...]\py39larrayenv\lib\site-packages\larray\core\array.py:1551: FutureWarning: In a future version, the Index constructor will not infer numeric dtypes when passed object-dtype sequences (matching Series behavior)
  index = pd.Index(data=self.axes[0].labels, name=axes_names[0])
@gdementen gdementen added bug priority: BLOCKER cannot make a release without these issues resolved labels Mar 14, 2023
@gdementen gdementen added this to the 0.34.1 milestone Mar 14, 2023
@gdementen gdementen added priority: high and removed priority: BLOCKER cannot make a release without these issues resolved labels Mar 15, 2023
@gdementen
Copy link
Contributor Author

Another line causing the same warning (I will have to check all uses of pd.Index()):

[...]\larray\core\array.py:1541: FutureWarning: In a future version, the Index constructor will not infer numeric dtypes when passed object-dtype sequences (matching Series behavior)
  columns = pd.Index(self.axes[-1].labels)

@gdementen
Copy link
Contributor Author

This happens when we have a numpy array of object dtype which only contains numeric values, which Pandas currently converts to a numeric index (e.g. Int64Index) instead of a generic/object Index (and will no longer do that)

Minimal test case:

>>> arr = ndtest("a=0..2").with_total()[:2]
>>> pd.Index(arr.a.labels)
FutureWarning: In a future version, the Index constructor will not infer numeric dtypes when passed object-dtype sequences (matching Series behavior)

@gdementen
Copy link
Contributor Author

This was introduced in Pandas 1.4. See pandas-dev/pandas#42870

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

No branches or pull requests

1 participant