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

BUG: pandas future warnings #100

Open
aburrell opened this issue Mar 12, 2024 · 1 comment
Open

BUG: pandas future warnings #100

aburrell opened this issue Mar 12, 2024 · 1 comment
Labels
bug Something isn't working
Milestone

Comments

@aburrell
Copy link
Member

Description

There are several future warnings to address

To Reproduce this bug:

  /home/runner/work/pysatMadrigal/pysatMadrigal/pysatMadrigal/instruments/methods/general.py:1363: FutureWarning: The behavior of array concatenation with empty entries is deprecated. In a future version, this will no longer exclude empty items when determining the result dtype. To retain the old behavior, exclude the empty entries before the concat operation.
    out = pds.concat(out_series).sort_index()

pysatMadrigal/tests/test_instruments.py: 18 warnings
  /opt/hostedtoolcache/Python/3.10.13/x64/lib/python3.10/site-packages/pysat/_instrument.py:2205: FutureWarning: 'S' is deprecated and will be removed in a future version, please use 's' instead.
    file_inc = pds.tseries.frequencies.to_offset(file_freq)

pysatMadrigal/tests/test_instruments.py::TestInstruments::test_download[inst_dict13]
  /home/runner/work/pysatMadrigal/pysatMadrigal/pysatMadrigal/instruments/dmsp_ssj.py:270: FutureWarning: 'AS-JAN' is deprecated and will be removed in a future version, please use 'YS-JAN' instead.
    if date_array.freq not in ['AS-JAN', 'YS', 'AS']:

pysatMadrigal/tests/test_instruments.py::TestInstruments::test_download[inst_dict13]
  /home/runner/work/pysatMadrigal/pysatMadrigal/pysatMadrigal/instruments/dmsp_ssj.py:270: FutureWarning: 'AS' is deprecated and will be removed in a future version, please use 'YS' instead.
    if date_array.freq not in ['AS-JAN', 'YS', 'AS']:

Test configuration

  • OS: All
  • Version: All
  • Other details about your setup that could be relevant: pandas v2.2.1
@aburrell aburrell added the bug Something isn't working label Mar 12, 2024
@aburrell aburrell added this to the v0.3.0 milestone Mar 12, 2024
@aburrell
Copy link
Member Author

Also:

  You are setting values through chained assignment. Currently this works in certain cases, but when using Copy-on-Write (which will become the default behaviour in pandas 3.0) this will never work to update the original DataFrame or Series, because the intermediate object on which we are setting values will behave as a copy.
  A typical example is when you are setting values in a column of a DataFrame, like:
  
  df["col"][row_indexer] = value
  
  Use `df.loc[row_indexer, "col"] = values` instead, to perform the assignment in a single step and ensure this keeps updating the original `df`.
  
  See the caveats in the documentation: https://pandas.pydata.org/pandas-docs/stable/user_guide/indexing.html#returning-a-view-versus-a-copy
  
    self[dvar][self[dvar] == -32766] = np.nan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant