Skip to content

CLN: make Info and DataFrameInfo subclasses #34743

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

Merged
merged 18 commits into from
Jun 29, 2020

Conversation

MarcoGorelli
Copy link
Member

precursor to #31796

Makes Info class and DataFrameInfo subclass so there's no need for all the

if isinstance(data, ABCDataFrame)

@MarcoGorelli MarcoGorelli changed the title make Info and DataFrameInfo subclasses CLN: make Info and DataFrameInfo subclasses Jun 13, 2020
@MarcoGorelli MarcoGorelli marked this pull request as draft June 13, 2020 10:28
Comment on lines -2463 to -2466
# Column Non-Null Count Dtype
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 int_col 5 non-null int64
1 text_col 5 non-null object
2 float_col 5 non-null float64
Copy link
Member Author

Choose a reason for hiding this comment

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

I'd accidentally introduced these extra whitespaces when I indented the docstrings as part of a previous PR, and so am fixing them now

@MarcoGorelli MarcoGorelli marked this pull request as ready for review June 13, 2020 10:48
@MarcoGorelli MarcoGorelli requested a review from jreback June 13, 2020 11:36
@MarcoGorelli MarcoGorelli requested a review from WillAyd June 14, 2020 10:53
Copy link
Contributor

@jreback jreback left a comment

Choose a reason for hiding this comment

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

looks pretty good

memory_usage: Optional[Union[bool, str]] = None,
null_counts: Optional[bool] = None,
):
if buf is None: # pragma: no cover
Copy link
Contributor

Choose a reason for hiding this comment

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

why do you need the pragma here?

Copy link
Member

Choose a reason for hiding this comment

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

Noticed this is in the current implementation. Not sure of reasoning but yea probably safe to remove

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, it was from the current implementation - have removed

show_counts = self.null_counts
exceeds_info_cols = col_count > max_cols

def _sizeof_fmt(num, size_qualifier):
Copy link
Contributor

Choose a reason for hiding this comment

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

move this to a module level function

for system-level memory consumption, and include it in the returned
values.

Returns
Copy link
Contributor

Choose a reason for hiding this comment

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

you can put all of the doc-strings on the base class

@jreback jreback added the Output-Formatting __repr__ of pandas objects, to_string label Jun 14, 2020
@MarcoGorelli MarcoGorelli requested a review from jreback June 18, 2020 07:29
@jreback jreback added this to the 1.1 milestone Jun 20, 2020
@jreback
Copy link
Contributor

jreback commented Jun 20, 2020

looks good can you merge master and ping on green.

@MarcoGorelli
Copy link
Member Author

looks good can you merge master and ping on green.

Thanks @jreback - green now

@MarcoGorelli
Copy link
Member Author

Friendly ping 😄 (sorry to do this, but I can submit a PR for Series.info if/when this is merged)

Copy link
Member

@WillAyd WillAyd left a comment

Choose a reason for hiding this comment

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

lgtm @jreback

@jreback jreback merged commit 02ab42f into pandas-dev:master Jun 29, 2020
@jreback
Copy link
Contributor

jreback commented Jun 29, 2020

thanks @MarcoGorelli very nice

@MarcoGorelli MarcoGorelli deleted the info-class branch October 10, 2020 14:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Clean Output-Formatting __repr__ of pandas objects, to_string
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants