Closed
Conversation
…patibility with pandas >=1.3.5
standage
commented
Nov 7, 2025
|
|
||
| # for some reason some int columns are behaving as floats -- this converts them | ||
| inDf = inDf.apply(pd.to_numeric, errors="ignore", downcast="integer") | ||
| inDf = inDf.apply(pd.to_numeric, errors="coerce", downcast="integer").fillna(inDf) |
Contributor
Author
There was a problem hiding this comment.
The errors="ignore" mode is deprecated in v2 and will be removed in v3. Its behavior can be replicated with "coerce" mode which inserts an NA in case of error, followed by filling NA values with the original dataframe.
| df = df.merge(orient, on="Type", how="left") | ||
| df["Type"] = df["Type"].str.replace("_", " ") | ||
| df["has_orientation"] = df["has_orientation"].fillna(value=False).infer_objects() | ||
| df["has_orientation"] = df["has_orientation"].astype(bool).fillna(value=False) |
Contributor
Author
There was a problem hiding this comment.
A couple places now require a bit more explicit handling of data types.
Comment on lines
-78
to
+80
| infernal["sframe"] = infernal["sframe"].replace(["-", "+"], [-1, 1]) | ||
| infernal["sframe"] = infernal["sframe"].replace({"-": "-1", "+": "1"}).astype("int16") |
Contributor
Author
There was a problem hiding this comment.
A couple places now require a bit more explicit handling of data types.
Comment on lines
-184
to
+185
| # adds a FeatureLocation object so it can be used in gbk construction | ||
| inDf["feat loc"] = inDf.apply(FeatureLocation_smart, axis=1) | ||
| if inDf.empty: | ||
| inDf = pd.DataFrame(columns=DF_COLS) | ||
| else: | ||
| # adds a FeatureLocation object so it can be used in gbk construction | ||
| inDf["feat loc"] = inDf.apply(FeatureLocation_smart, axis=1) |
Contributor
Author
There was a problem hiding this comment.
The changes I made to this file were not necessary for pandas v2 support. I only encountered errors when I downgraded to pandas v1.3.5 for testing. But the updated code should work across all supported versions.
2 tasks
Contributor
Author
|
Superseded by #59. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The PR makes a few marginal changes to unlock support for pandas version 2. I ensured that all changes were compatible with pandas 1.3.5, currently the minimal supported version.
Partially addresses #56.