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

Replacing deprecated in1d with isin #2395

Merged
merged 4 commits into from
Sep 19, 2024
Merged

Conversation

quant12345
Copy link
Contributor

This PR removes many warnings: DeprecationWarning: in1d is deprecated. Use np.isin instead.

isin in contrast to in1d: return the same shape as element

element = np.array([[0, 1, 2, 5, 33], [3, 7, 12, 15, 10]])
test_elements = [0, 2, 15]

isin
print(np.isin(element, test_elements))

Output

[[ True False  True False False]
 [False False False  True False]]

in1d
print(np.in1d(element, test_elements))

Output
[ True False True False False False False False True False]

@vogt31337
Copy link
Contributor

@quant12345 Thanks for the patch! I did not read the whole conversation, but did the testing not catch this error? I'd like to repair the test system and enhance it to be able to capture this event.

@quant12345
Copy link
Contributor Author

quant12345 commented Sep 18, 2024

@vogt31337 you are asking about this error?
If so, then this PR does not affect this bug. I just mentioned it in this PR.

@vogt31337
Copy link
Contributor

Okay then I'll Accept it when the tests are finished.

@quant12345
Copy link
Contributor Author

quant12345 commented Sep 18, 2024

@vogt31337 but this error needs to be fixed. I suggest you move to issues for discussion. I already understood why it occurs, if something is not clear, do not hesitate to ask. The reason is the new matpowercaseframes 1.0.9. It creates a dataframe with pandas types. When the dataframe is converted to a numpy array, numpy does not understand the type of this data and saves it with the object type.

Here's how to reproduce it. And in the main message, why this error occurs.
Previously pandas types were float64 and int64 and after conversion to numpy they all became float64. In matpowercaseframes 1.0.9 it is Float64, Int64(pandas types).
For me and yasirroni the main question is whether strictly int or float types are needed in some cases?
(this can wait and is a common mistake)

Copy link

codecov bot commented Sep 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 76.00%. Comparing base (391a6e1) to head (4fd9ab0).
Report is 5 commits behind head on develop.

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #2395   +/-   ##
========================================
  Coverage    76.00%   76.00%           
========================================
  Files          282      282           
  Lines        32954    32954           
========================================
  Hits         25048    25048           
  Misses        7906     7906           

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

@vogt31337 vogt31337 merged commit 0b74d27 into e2nIEE:develop Sep 19, 2024
17 of 25 checks passed
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