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

Pandas warning: Calling int on a single element Series is deprecated and will raise a TypeError #1493

Closed
hyanwong opened this issue Jun 18, 2023 · 1 comment

Comments

@hyanwong
Copy link
Contributor

Short description of the problem:
importing stdpopsim under pandas 2.0.1 results in a warning

How to reproduce the problem:

Python 3.10.10 | packaged by conda-forge | (main, Mar 24 2023, 20:17:34) [Clang 14.0.6 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import stdpopsim
/Users/yan/mambaforge/lib/python3.10/site-packages/stdpopsim/catalog/HomSap/demographic_models.py:158: FutureWarning: Calling int on a single element Series is deprecated and will raise a TypeError in the future. Use int(ser.iloc[0]) instead
  time=int(extended_GF.time.head(1) - 1), rate=0
mambaforge/lib/python3.10/site-packages/stdpopsim/catalog/HomSap/demographic_models.py:161: FutureWarning: Calling int on a single element Series is deprecated and will raise a TypeError in the future. Use int(ser.iloc[0]) instead
  time=int(extended_GF.time.tail(1) + 1), rate=0
>>> import pandas
>>> pandas.__version__
'2.0.1'
@nspope
Copy link
Collaborator

nspope commented Jul 5, 2024

Looks like this got fixed by #1416 some time ago; code now reads https://github.com/popsim-consortium/stdpopsim/blame/b46b3d1dd9ad188d9a5bd6a36a90a9c69ae8f1a6/stdpopsim/catalog/HomSap/demographic_models.py#L146

and doesn't throw an error. Guess that this fix was post-0.2.0 release which is why Yan is picking up the error.

@nspope nspope closed this as completed Jul 5, 2024
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