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

Cast the column to the correct type before assigning values #2371

Merged
merged 8 commits into from
Aug 29, 2024

Conversation

quant12345
Copy link
Contributor

@quant12345 quant12345 commented Aug 8, 2024

This PR removes many warnings: FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas.

I see in warnings (3.12, 2) it too, but as an error:
ERROR pandapower/test/plotting/test_geo.py - FutureWarning: Setting an item of incompatible dtype is deprecated and will raise an error in a future version of pandas. Value '[-2, -3]' has dtype incompatible with int32, please explicitly cast to a compatible dtype first.

Update 09.09.2024

What was done:
mv_oberrhein.py:76
Column net.trafo["tap_pos"] has values ​​nan and this is float type, so astype("float64").

from_ppc.py:336
branch_lookup.loc[is_impedance, "element"] = idx_impedance
although all masks is_impedance [False False False False False False False] and
idx_impedance represents an empty list, which changes the type from int64 to float64, so astype("float64").

create.py:5990
moved line 5991 up to convert column to correct type before assignment

geo.py:556, test_iec60909_4.py:470
the value to set is a string or None, so the type is object

grid_modification.py:1217-1219
Since val can contain both string and numeric values, I define the column type based on the values.

grid_modification.py:1232-1233, 1399-1400, 1621-1622
Casting values to column type net[table]"element"]

@quant12345
Copy link
Contributor Author

quant12345 commented Aug 8, 2024

Tests with changes to grid_modification.py fail. Will close PR. Maybe reopen.

Update 09.09.2024: Figured out why there was an error, see grid_modification.py:1217-1219 above.

Copy link

codecov bot commented Aug 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.00%. Comparing base (a044a46) to head (5808955).
Report is 9 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2371   +/-   ##
========================================
  Coverage    76.00%   76.00%           
========================================
  Files          282      282           
  Lines        32945    32950    +5     
========================================
+ Hits         25040    25045    +5     
  Misses        7905     7905           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@quant12345 quant12345 closed this Aug 8, 2024
@quant12345 quant12345 reopened this Aug 9, 2024
vogt31337
vogt31337 previously approved these changes Aug 28, 2024
@vogt31337 vogt31337 merged commit 11af12c into e2nIEE:develop Aug 29, 2024
13 of 22 checks passed
@quant12345 quant12345 deleted the dtype branch September 8, 2024 10:59
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.

2 participants