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

Support pandas 2.0 #134

Closed
pmav99 opened this issue Apr 20, 2023 · 5 comments
Closed

Support pandas 2.0 #134

pmav99 opened this issue Apr 20, 2023 · 5 comments

Comments

@pmav99
Copy link
Collaborator

pmav99 commented Apr 20, 2023

As mentioned by @uturuncoglu here

Traceback (most recent call last):
  File "merge.py", line 12, in <module>
    model.results()
  File "/Users/turuncu/miniconda3/envs/schism/lib/python3.8/site-packages/pyposeidon/schism.py", line 1476, in results
    sdate = pd.Timestamp(
  File "pandas/_libs/tslibs/timestamps.pyx", line 1656, in pandas._libs.tslibs.timestamps.Timestamp.__new__
  File "pandas/_libs/tslibs/timezones.pyx", line 172, in pandas._libs.tslibs.timezones.maybe_get_tz
TypeError: unsupported type for timedelta seconds component: numpy.int64

This is also causing a test to fail when running under pandas 2.0:

  pyposeidon/d3d.py:306: FutureWarning: In a future version of pandas all arguments of StringMethods.split except for the argument 'pat' will be keyword-only.
    d2 = df.loc[tlines, "data"].str.split("=", 2, expand=True)
pmav99 added a commit to pmav99/pyPoseidon that referenced this issue Jun 8, 2023
@brey
Copy link
Collaborator

brey commented Oct 18, 2023

@pmav99 Is this still an issue?

@pmav99
Copy link
Collaborator Author

pmav99 commented Oct 18, 2023

We are still pinning pandas < 2.

I released the constrained, updated the packages and run the tests. They are passing but there are a bunch of FutureWarnings:

tests/test_dem_fix.py: 8 warnings
tests/test_mesh.py: 4 warnings
tests/test_mesh_global.py: 2 warnings
  /home/panos/Prog/poseidon/pyPoseidon/pyposeidon/mjigsaw.py:146: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
    npoints = int(grid.loc[2].str.split("=")[0][1])

tests/test_dem_fix.py: 8 warnings
tests/test_mesh.py: 4 warnings
tests/test_mesh_global.py: 2 warnings
  /home/panos/Prog/poseidon/pyPoseidon/pyposeidon/mjigsaw.py:154: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
    nedges = int(grid.loc[ie].str.split("=")[0][1])

tests/test_dem_fix.py: 8 warnings
tests/test_mesh.py: 4 warnings
tests/test_mesh_global.py: 2 warnings
  /home/panos/Prog/poseidon/pyPoseidon/pyposeidon/mjigsaw.py:161: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
    ntria = int(grid.loc[i3].str.split("=")[0][1])

tests/test_dem_io.py: 4 warnings
tests/test_execution_control.py: 2 warnings
tests/test_schism_mesh.py: 2 warnings
tests/test_mesh_global.py: 4 warnings
tests/test_update.py: 4 warnings
tests/test_schism.py: 1 warning
  /home/panos/Prog/poseidon/pyPoseidon/pyposeidon/mesh.py:232: FutureWarning: Series.__getitem__ treating keys as positions is deprecated. In a future version, integer keys will always be treated as labels (consistent with DataFrame behavior). To access a value by position, use `ser.iloc[pos]`
    ni, nj = df.iloc[0].str.split()[0]

Do you wanna take a look? You need to upgrade pandas to 2.1 and run the tests.

@tomsail
Copy link
Collaborator

tomsail commented Oct 19, 2023

confirming also for pandas<2, it conflicts when having analysea in the same conda env

@tomsail
Copy link
Collaborator

tomsail commented Nov 6, 2023

Just did it. All tests run fine. creating PR

@tomsail
Copy link
Collaborator

tomsail commented Nov 6, 2023

Actually not that straightforward. I am puzzled that I can't reproduced the errors on the CI though.. On my machine everything was running fine. See #170 for reference

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

3 participants