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

267 to pandas as function #272

Merged
merged 3 commits into from
Dec 11, 2023
Merged

267 to pandas as function #272

merged 3 commits into from
Dec 11, 2023

Conversation

perolavsvendsen
Copy link
Member

@perolavsvendsen perolavsvendsen commented Dec 8, 2023

Solve #267

The to_pandas implementation is inconsistently implemented. In Table, it is implemented as a property. While similar looking to_arrow is a method. Also, the name indicates that this should be a function. to_pandas is also a function in other object classes, e.g. Polygons.to_pandas().

🟩 This PR restructures the tests somewhat and adds tests for methods/functions that was not tested.
🟩 This PR changes Table.to_pandas from a property to a function. ⚠️ Breaking change ⚠️

Old pattern (discontinued with this PR):

df = mytable.to_pandas

New pattern (introduced with this PR):

df = mytable.to_pandas()

@perolavsvendsen perolavsvendsen requested review from daniel-sol and a team December 8, 2023 12:19
Copy link
Contributor

@equinor-ruaj equinor-ruaj left a comment

Choose a reason for hiding this comment

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

lgtm

@markusdregi
Copy link

Old pattern (deprecated with this PR)

It is strictly speaking not deprecated, but discontinued. Deprecating functionality would imply that mytable.to_pandas would continue to function, but be deprecated and to be discontinued in the future (typically documented in the docs and in addition yielding a DeprecationWarning). It would make the change a two step procedure, but allows consumers to migrate with an intermediate state yielding warnings, without immediately breaking the behaviour.

@perolavsvendsen
Copy link
Member Author

Old pattern (deprecated with this PR)

It is strictly speaking not deprecated, but discontinued. Deprecating functionality would imply that mytable.to_pandas would continue to function, but be deprecated and to be discontinued in the future (typically documented in the docs and in addition yielding a DeprecationWarning). It would make the change a two step procedure, but allows consumers to migrate with an intermediate state yielding warnings, without immediately breaking the behaviour.

True! Changed in the original text ✅

Do you know of a way to actually deprecate something like this (i.e. give warning but still work)? I could not find a way to redirect the property to_pandas to the function to_pandas because it will mean def to_pandas(self) twice....

@perolavsvendsen perolavsvendsen merged commit 8e96fa9 into main Dec 11, 2023
16 checks passed
@perolavsvendsen perolavsvendsen deleted the 267-to_pandas-as-function branch December 11, 2023 06:29
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.

3 participants