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

Fixes following pandas 2 #327

Merged
merged 8 commits into from
Apr 24, 2023
Merged

Fixes following pandas 2 #327

merged 8 commits into from
Apr 24, 2023

Conversation

dnerini
Copy link
Member

@dnerini dnerini commented Apr 22, 2023

Minor adjustments following the release of pandas 2:

  • in tdating.py use pd.concat instead of pd.DataFrame().append which was effectively removed (ref).
  • in salscores.py: Division by zero returns -inf, nan, or inf depending on the numerator, instead of raising (but I wasn't able to understand exactly the root cause of this breaking change...)

Additionally,

  • Fix scipy.ndimage's DeprecationWarnings
  • Fix pandas' SettingWithCopyWarnings

@codecov
Copy link

codecov bot commented Apr 23, 2023

Codecov Report

Patch coverage: 93.47% and project coverage change: -0.01 ⚠️

Comparison is base (1c90e44) 83.34% compared to head (c527501) 83.34%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #327      +/-   ##
==========================================
- Coverage   83.34%   83.34%   -0.01%     
==========================================
  Files         161      161              
  Lines       12359    12355       -4     
==========================================
- Hits        10301    10297       -4     
  Misses       2058     2058              
Flag Coverage Δ
unit_tests 83.34% <93.47%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pysteps/motion/constant.py 33.33% <50.00%> (ø)
pysteps/extrapolation/semilagrangian.py 70.10% <66.66%> (ø)
pysteps/blending/steps.py 83.89% <100.00%> (ø)
pysteps/feature/tstorm.py 94.16% <100.00%> (-0.24%) ⬇️
pysteps/motion/vet.py 87.33% <100.00%> (ø)
pysteps/nowcasts/sseps.py 87.19% <100.00%> (ø)
pysteps/nowcasts/steps.py 81.45% <100.00%> (ø)
pysteps/nowcasts/utils.py 97.57% <100.00%> (ø)
pysteps/tracking/tdating.py 91.53% <100.00%> (+0.06%) ⬆️
pysteps/verification/salscores.py 90.42% <100.00%> (ø)
... and 1 more

... and 28 files with indirect coverage changes

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@dnerini dnerini marked this pull request as ready for review April 23, 2023 19:55
@dnerini dnerini self-assigned this Apr 23, 2023
@dnerini dnerini changed the title Fixes following pandas 2.0.0 Fixes following pandas 2 Apr 23, 2023
@@ -211,12 +211,12 @@ def tracking(cells_id, cells_id_prev, labels, V1, max_ID):
size.append(len(x))
biggest = np.argmax(size)
new_ID = new_ID[biggest]
cells_id_new.ID.iloc[ID] = new_ID
cells_id_new.loc[index, "ID"] = new_ID
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

using .loc[index, "ID"] instead of .ID.iloc[ID] avoids the warning by removing the chaining operation. In this case, .loc should be more suited than .iloc since indexrefers to the index label and not the index position (although the two are in fact the same value...).

@dnerini dnerini merged commit ad0e6ea into master Apr 24, 2023
@dnerini dnerini deleted the fix-pandas-2 branch April 24, 2023 13:18
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

Successfully merging this pull request may close these issues.

1 participant