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
Address Warnings from pandas in METcalcpy code #249
Comments
cannot reproduce using pandas 1.2.3. Updating to pandas 1.5 doesn't reproduce the warnings either. This is because the code that generates the warning isn't getting tested. Create tests for the util.utils.sum_stat aggregate_special_fields() code. |
Possible candidates for replacing pd.append with pd.concat:
Reason:
6.metcalcpy.agg_stat_eqz
Task:
|
… raise an error and replace the soon-to-be deprecated some_df.append(add_df) to pd.concat([some_df, add_df])
…soon-to-be deprecated pandas append rather than concat
…e for the calculat_values() and run_ee_on_axis() functions which were originally using pandas append rather than the concat. Append will be deprecated in future versions of pandas.
…c.loc avoids this error. While testing for FutureWarning for pandas 1.5.1, an issue with InvalidIndexError when using DataFrame.at in the following code: df_roc.at[df_roc.index[df_roc["thresh"] == thresh], 'n11'] = sum(data[is_bigger]['oy_i']) df_roc.at[df_roc.index[df_roc["thresh"] == thresh], 'n10'] = sum(data[is_bigger]['on_i']) df_roc.at[df_roc.index[df_roc["thresh"] == thresh], 'n01'] = sum(data[is_less]['oy_i']) df_roc.at[df_roc.index[df_roc["thresh"] == thresh], 'n00'] = sum(data[is_less]['on_i'])
Code changes made for items 1-4 |
…error') to catch any FutureWarnings, replace pd.append with pd.concat
…rnings and replace pd.append with pd.concat
…scovered with pandas versions 1.2, 1.3, and 1.5 vs 1.4
code changes made to item 5 and 6. |
* Issue #249 filter FutureWarning in the equalize_axis_data function to raise an error and replace the soon-to-be deprecated some_df.append(add_df) to pd.concat([some_df, add_df]) * Issue #249 Add test for the FutureWarning in equalize_axis_data() function. * Issue #249 event equalize data used to test the code that still uses soon-to-be deprecated pandas append rather than concat * Issue #249 Added test for FutureWarning in the agg_stat_event_equalize module's calculate_value. * Issue #249 cleaned up unneccessary comments * Issue #249 Added test for FutureWarning in the agg_stat_event_equalize for the calculat_values() and run_ee_on_axis() functions which were originally using pandas append rather than the concat. Append will be deprecated in future versions of pandas. * Issue #249 Due to changes in pandas>1.2, replace df_roc.at with df_roc.loc avoids this error. While testing for FutureWarning for pandas 1.5.1, an issue with InvalidIndexError when using DataFrame.at in the following code: df_roc.at[df_roc.index[df_roc["thresh"] == thresh], 'n11'] = sum(data[is_bigger]['oy_i']) df_roc.at[df_roc.index[df_roc["thresh"] == thresh], 'n10'] = sum(data[is_bigger]['on_i']) df_roc.at[df_roc.index[df_roc["thresh"] == thresh], 'n01'] = sum(data[is_less]['oy_i']) df_roc.at[df_roc.index[df_roc["thresh"] == thresh], 'n00'] = sum(data[is_less]['on_i']) * Issue #249 Remove try-except block and use warnings.filter_warnings('error') to catch any FutureWarnings, replace pd.append with pd.concat * Issue #249 use warnings.filter_warnings('error') to capture Future warnings and replace pd.append with pd.concat * Issue #249 address FutureWarnings and address compatibility issues discovered with pandas versions 1.2, 1.3, and 1.5 vs 1.4 * Issue #249 tests for FutureWarnings * Fixed conflict * Delete requirements_36.txt No longer relevant. No longer supporting Python 3.6 * Issue #249 replacing pd.append with pd.concat and adding tests for functions that can be tested * #249 Additional sample data * #249 add the test_future_warnings test to the list of tests to run * Update requirements.txt addressing Dependabot buffer over-flow in Pillow https://github.com/dtcenter/METcalcpy/security/dependabot/22 * Update requirements.txt https://github.com/dtcenter/METcalcpy/security/dependabot/20
* Update unit_tests.yml replace 3.8.6 and 3.8.12 with 3.8 for Python because latest version of ubuntu does not have support for python 3.8.6 * Feature 251 test scorecard (#253) * Issue #251 In Pandas 1.3 and above, the SettingWithCopy Warning category has been removed. Replace the check for category=SettingWithCopyWarning with Warning, since SettingWithCopyWarning is a subclass of Warning * Added ending asterisks for end bold to fix these warnings: WARNING: Inline strong start-string without end-string. Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * Feature 250 test event equalize (#252) * Remove Python 3.8.6 and 3.8.12 and use Python 3.8 instead. The latest version of ubuntu no longer has python 3.8.6 available. * Issue #250 fix the test_equalize_axis_data_no_fcst_var fixture * Added ending asterisks for end bold to fix these warnings: WARNING: Inline strong start-string without end-string. * #251 allow test to run check on numpy types regardless of numpy version * Update unit_tests.yml add python 3.10 to testing to evaluate package compatibility * Update unit_tests.yml remove Python 3.10 there are issues with HDF5 Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * Delete requirements_36.txt Python 3.6 no longer supported * #249 Add test_future_warnings test * #249 additional sample data * Update requirements.txt https://github.com/dtcenter/METcalcpy/security/dependabot/22 * Update requirements.txt https://github.com/dtcenter/METcalcpy/security/dependabot/20 * #249 replacing pd.append with pd.concat and adding tests and data * #249 added tests * #249 Additional test data * Revert "Merge branch 'develop' of https://github.com/dtcenter/METcalcpy into bugfix_249_warnings" This reverts commit 7f203bf, reversing changes made to dd87d77. Co-authored-by: Julie Prestopnik <jpresto@ucar.edu>
still need to address issue 1 |
* Issue #249 filter FutureWarning in the equalize_axis_data function to raise an error and replace the soon-to-be deprecated some_df.append(add_df) to pd.concat([some_df, add_df]) * Issue #249 Add test for the FutureWarning in equalize_axis_data() function. * Issue #249 event equalize data used to test the code that still uses soon-to-be deprecated pandas append rather than concat * Issue #249 Added test for FutureWarning in the agg_stat_event_equalize module's calculate_value. * Issue #249 cleaned up unneccessary comments * Issue #249 Added test for FutureWarning in the agg_stat_event_equalize for the calculat_values() and run_ee_on_axis() functions which were originally using pandas append rather than the concat. Append will be deprecated in future versions of pandas. * Issue #249 Due to changes in pandas>1.2, replace df_roc.at with df_roc.loc avoids this error. While testing for FutureWarning for pandas 1.5.1, an issue with InvalidIndexError when using DataFrame.at in the following code: df_roc.at[df_roc.index[df_roc["thresh"] == thresh], 'n11'] = sum(data[is_bigger]['oy_i']) df_roc.at[df_roc.index[df_roc["thresh"] == thresh], 'n10'] = sum(data[is_bigger]['on_i']) df_roc.at[df_roc.index[df_roc["thresh"] == thresh], 'n01'] = sum(data[is_less]['oy_i']) df_roc.at[df_roc.index[df_roc["thresh"] == thresh], 'n00'] = sum(data[is_less]['on_i']) * Issue #249 Remove try-except block and use warnings.filter_warnings('error') to catch any FutureWarnings, replace pd.append with pd.concat * Issue #249 use warnings.filter_warnings('error') to capture Future warnings and replace pd.append with pd.concat * Issue #249 address FutureWarnings and address compatibility issues discovered with pandas versions 1.2, 1.3, and 1.5 vs 1.4 * Issue #249 tests for FutureWarnings * Fixed conflict * Delete requirements_36.txt No longer relevant. No longer supporting Python 3.6 * Issue #249 replacing pd.append with pd.concat and adding tests for functions that can be tested * #249 Additional sample data * #249 add the test_future_warnings test to the list of tests to run * Update requirements.txt addressing Dependabot buffer over-flow in Pillow https://github.com/dtcenter/METcalcpy/security/dependabot/22 * Update requirements.txt https://github.com/dtcenter/METcalcpy/security/dependabot/20 * Update sum_stat.py * Issue #249 on line 238, replaced the pd.append with pd.concat to address FutureWarning
Remember to make updates to the requirements.txt to be consistent with the nco_requirements |
* Bump pillow from 8.3.2 to 9.3.0 (#260) Bumps [pillow](https://github.com/python-pillow/Pillow) from 8.3.2 to 9.3.0. - [Release notes](https://github.com/python-pillow/Pillow/releases) - [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst) - [Commits](python-pillow/Pillow@8.3.2...9.3.0) --- updated-dependencies: - dependency-name: pillow dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bugfix 251 test scorecard (#256) * Replace Python versions 3.8.6 and 3.8.12 with 3.8 * Bugfix #251 replace SettingWithCopyWarning with Warning. SettingWithCopyWarning no longer available for this check * Adding double asterisks to end bolding on mulitple lines Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * bugfix_249_warnings (#261) * Update unit_tests.yml replace 3.8.6 and 3.8.12 with 3.8 for Python because latest version of ubuntu does not have support for python 3.8.6 * Feature 251 test scorecard (#253) * Issue #251 In Pandas 1.3 and above, the SettingWithCopy Warning category has been removed. Replace the check for category=SettingWithCopyWarning with Warning, since SettingWithCopyWarning is a subclass of Warning * Added ending asterisks for end bold to fix these warnings: WARNING: Inline strong start-string without end-string. Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * Feature 250 test event equalize (#252) * Remove Python 3.8.6 and 3.8.12 and use Python 3.8 instead. The latest version of ubuntu no longer has python 3.8.6 available. * Issue #250 fix the test_equalize_axis_data_no_fcst_var fixture * Added ending asterisks for end bold to fix these warnings: WARNING: Inline strong start-string without end-string. * #251 allow test to run check on numpy types regardless of numpy version * Update unit_tests.yml add python 3.10 to testing to evaluate package compatibility * Update unit_tests.yml remove Python 3.10 there are issues with HDF5 Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * Delete requirements_36.txt Python 3.6 no longer supported * #249 Add test_future_warnings test * #249 additional sample data * Update requirements.txt https://github.com/dtcenter/METcalcpy/security/dependabot/22 * Update requirements.txt https://github.com/dtcenter/METcalcpy/security/dependabot/20 * #249 replacing pd.append with pd.concat and adding tests and data * #249 added tests * #249 Additional test data * Revert "Merge branch 'develop' of https://github.com/dtcenter/METcalcpy into bugfix_249_warnings" This reverts commit 7f203bf, reversing changes made to dd87d77. Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * Adding file based on testing on Acorn for NCO (#265) * Per #267, updating modulefiles * Adding script for testing on WCOSS2 * Correcting filename * Bugfix release (#272) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> Co-authored-by: Hank Fisher <fisherh@ucar.edu>
* Delete requirements_36.txt Python 3.6 no longer supported * #249 Add test_future_warnings test * #249 additional sample data * Bugfix Issue #249 Future Warnings- replace append with pd.concat * Bugfix issue #249 add the test for future warnings * Bugfix #249 additional data * Bugfix Issue #249 additional data that wasn't previously committed * Bugfix #249 add sum stat import * Bugfix #249 added workflow to check for Python package vulnerabilities * Updated requirements.txt for nco and all others * issue #249 add imports to pandas and warning * Bugfix 249 future warnings (#280) * Bump pillow from 8.3.2 to 9.3.0 (#260) Bumps [pillow](https://github.com/python-pillow/Pillow) from 8.3.2 to 9.3.0. - [Release notes](https://github.com/python-pillow/Pillow/releases) - [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst) - [Commits](python-pillow/Pillow@8.3.2...9.3.0) --- updated-dependencies: - dependency-name: pillow dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bugfix 251 test scorecard (#256) * Replace Python versions 3.8.6 and 3.8.12 with 3.8 * Bugfix #251 replace SettingWithCopyWarning with Warning. SettingWithCopyWarning no longer available for this check * Adding double asterisks to end bolding on mulitple lines Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * bugfix_249_warnings (#261) * Update unit_tests.yml replace 3.8.6 and 3.8.12 with 3.8 for Python because latest version of ubuntu does not have support for python 3.8.6 * Feature 251 test scorecard (#253) * Issue #251 In Pandas 1.3 and above, the SettingWithCopy Warning category has been removed. Replace the check for category=SettingWithCopyWarning with Warning, since SettingWithCopyWarning is a subclass of Warning * Added ending asterisks for end bold to fix these warnings: WARNING: Inline strong start-string without end-string. Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * Feature 250 test event equalize (#252) * Remove Python 3.8.6 and 3.8.12 and use Python 3.8 instead. The latest version of ubuntu no longer has python 3.8.6 available. * Issue #250 fix the test_equalize_axis_data_no_fcst_var fixture * Added ending asterisks for end bold to fix these warnings: WARNING: Inline strong start-string without end-string. * #251 allow test to run check on numpy types regardless of numpy version * Update unit_tests.yml add python 3.10 to testing to evaluate package compatibility * Update unit_tests.yml remove Python 3.10 there are issues with HDF5 Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * Delete requirements_36.txt Python 3.6 no longer supported * #249 Add test_future_warnings test * #249 additional sample data * Update requirements.txt https://github.com/dtcenter/METcalcpy/security/dependabot/22 * Update requirements.txt https://github.com/dtcenter/METcalcpy/security/dependabot/20 * #249 replacing pd.append with pd.concat and adding tests and data * #249 added tests * #249 Additional test data * Revert "Merge branch 'develop' of https://github.com/dtcenter/METcalcpy into bugfix_249_warnings" This reverts commit 7f203bf, reversing changes made to dd87d77. Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * Adding file based on testing on Acorn for NCO (#265) * Per #267, updating modulefiles * Adding script for testing on WCOSS2 * Correcting filename * Bugfix release (#272) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> Co-authored-by: Hank Fisher <fisherh@ucar.edu> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> Co-authored-by: Hank Fisher <fisherh@ucar.edu>
* Delete requirements_36.txt Python 3.6 no longer supported * #249 Add test_future_warnings test * #249 additional sample data * Bugfix Issue #249 Future Warnings- replace append with pd.concat * Bugfix issue #249 add the test for future warnings * Bugfix #249 additional data * Bugfix Issue #249 additional data that wasn't previously committed * Bugfix #249 add sum stat import * Bugfix #249 added workflow to check for Python package vulnerabilities * Updated requirements.txt for nco and all others * issue #249 add imports to pandas and warning * Bugfix 249 future warnings (#280) * Bump pillow from 8.3.2 to 9.3.0 (#260) Bumps [pillow](https://github.com/python-pillow/Pillow) from 8.3.2 to 9.3.0. - [Release notes](https://github.com/python-pillow/Pillow/releases) - [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst) - [Commits](python-pillow/Pillow@8.3.2...9.3.0) --- updated-dependencies: - dependency-name: pillow dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> * Bugfix 251 test scorecard (#256) * Replace Python versions 3.8.6 and 3.8.12 with 3.8 * Bugfix #251 replace SettingWithCopyWarning with Warning. SettingWithCopyWarning no longer available for this check * Adding double asterisks to end bolding on mulitple lines Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * bugfix_249_warnings (#261) * Update unit_tests.yml replace 3.8.6 and 3.8.12 with 3.8 for Python because latest version of ubuntu does not have support for python 3.8.6 * Feature 251 test scorecard (#253) * Issue #251 In Pandas 1.3 and above, the SettingWithCopy Warning category has been removed. Replace the check for category=SettingWithCopyWarning with Warning, since SettingWithCopyWarning is a subclass of Warning * Added ending asterisks for end bold to fix these warnings: WARNING: Inline strong start-string without end-string. Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * Feature 250 test event equalize (#252) * Remove Python 3.8.6 and 3.8.12 and use Python 3.8 instead. The latest version of ubuntu no longer has python 3.8.6 available. * Issue #250 fix the test_equalize_axis_data_no_fcst_var fixture * Added ending asterisks for end bold to fix these warnings: WARNING: Inline strong start-string without end-string. * #251 allow test to run check on numpy types regardless of numpy version * Update unit_tests.yml add python 3.10 to testing to evaluate package compatibility * Update unit_tests.yml remove Python 3.10 there are issues with HDF5 Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * Delete requirements_36.txt Python 3.6 no longer supported * #249 Add test_future_warnings test * #249 additional sample data * Update requirements.txt https://github.com/dtcenter/METcalcpy/security/dependabot/22 * Update requirements.txt https://github.com/dtcenter/METcalcpy/security/dependabot/20 * #249 replacing pd.append with pd.concat and adding tests and data * #249 added tests * #249 Additional test data * Revert "Merge branch 'develop' of https://github.com/dtcenter/METcalcpy into bugfix_249_warnings" This reverts commit 7f203bf, reversing changes made to dd87d77. Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> * Adding file based on testing on Acorn for NCO (#265) * Per #267, updating modulefiles * Adding script for testing on WCOSS2 * Correcting filename * Bugfix release (#272) --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> Co-authored-by: Hank Fisher <fisherh@ucar.edu> --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Julie Prestopnik <jpresto@ucar.edu> Co-authored-by: Hank Fisher <fisherh@ucar.edu>
Describe the Problem
A user discovered a DeprecationWarning in the METcalcpy code (utils module) when using METviewer:
dtcenter/METplus#1988
Identify all METcalcpy code that is using pd.append and replace with pd.concat.
When running the metviewer batch job from WCOSS2, receiving warning message as
Expected Behavior
Create a test in METcalcpy/test/test_utils.py to reproduce the warning.
Environment
Describe your runtime environment:
1. Machine: (e.g. HPC name, Linux Workstation, Mac Laptop)
2. OS: (e.g. RedHat Linux, MacOS)
3. Software version number(s)
To Reproduce
Describe the steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error
Post relevant sample data following these instructions:
https://dtcenter.org/community-code/model-evaluation-tools-met/met-help-desk#ftp
Relevant Deadlines
List relevant project deadlines here or state NONE.
Funding Source
2792542, 2773542
Define the Metadata
Assignee
Labels
Projects and Milestone
Define Related Issue(s)
Consider the impact to the other METplus components.
Bugfix Checklist
See the METplus Workflow for details.
Branch name:
bugfix_<Issue Number>_main_<Version>_<Description>
Pull request:
bugfix <Issue Number> main_<Version> <Description>
Select: Reviewer(s) and Development issues
Select: Organization level software support Project for the current coordinated release
Select: Milestone as the next bugfix version
Branch name:
bugfix_<Issue Number>_develop_<Description>
Pull request:
bugfix <Issue Number> develop <Description>
Select: Reviewer(s) and Development issues
Select: Repository level development cycle Project for the next official release
Select: Milestone as the next official version
The text was updated successfully, but these errors were encountered: