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

Deprecate Index.summary #18217

Closed
TomAugspurger opened this Issue Nov 10, 2017 · 8 comments

Comments

Projects
None yet
6 participants
@TomAugspurger
Copy link
Contributor

commented Nov 10, 2017

In [88]: idx = pd.Index([1, 2, 3])

In [89]: idx.summary()
Out[89]: 'Int64Index: 3 entries, 1 to 3'

@TomAugspurger TomAugspurger added this to the Next Major Release milestone Nov 10, 2017

@jreback

This comment has been minimized.

Copy link
Contributor

commented Nov 10, 2017

this is also a useless method and should be deprecated

@gfyoung

This comment has been minimized.

Copy link
Member

commented Nov 10, 2017

Well, Index has no summary methods like .info or .describe (vs. DataFrame or Series). Might be worthwhile to beef this up so that we can return more meaningful info.

@jreback jreback added the Deprecate label Nov 13, 2017

@jreback jreback referenced this issue Nov 13, 2017

Open

DEPR: let's deprecate #18262

15 of 36 tasks complete
@jorisvandenbossche

This comment has been minimized.

Copy link
Member

commented Nov 13, 2017

I would also deprecate this, and separately we can think whether it is worth to add a info() method to Index?

@TomAugspurger TomAugspurger changed the title Index.summary is undocumented Deprecate Index.summary Nov 13, 2017

@punzalan

This comment has been minimized.

Copy link

commented Nov 29, 2017

Apologies if any of this is super naive. I'm new.

Deleting the method and any tests directly targeting it isn't enough. There are other failures like

__ TestDataFrameReprInfoEtc.test_info_duplicate_columns_shows_correct_dtypes ___

self = <pandas.tests.frame.test_repr_info.TestDataFrameReprInfoEtc object at 0x7f34597891d0>

    def test_info_duplicate_columns_shows_correct_dtypes(self):
        # GH11761
        io = StringIO()

        frame = DataFrame([[1, 2.0]],
                          columns=['a', 'a'])
        frame.info(buf=io)
        io.seek(0)
        lines = io.readlines()
>       assert 'a    1 non-null int64\n' == lines[3]
E       AssertionError: assert 'a    1 non-null int64\n' == 'a    1 non-null float64\n'
E         - a    1 non-null int64
E         ?                 ^^
E         + a    1 non-null float64
E         ?                 ^^^^

The reason is the output of summary is included in the output of pandas.DataFrame.info.

In [11]: # pretend the variables in the test are available here

In [12]: lines
Out[12]: 
["<class 'pandas.core.frame.DataFrame'>\n",
 'RangeIndex: 1 entries, 0 to 0\n',
 'Data columns (total 2 columns):\n',
 'a    1 non-null int64\n',
 'a    1 non-null float64\n',
 'dtypes: float64(1), int64(1)\n',
 'memory usage: 96.0 bytes\n']

(That second element is the output from summary.)

Would it be more appropriate to

  • replace Index.summary with Index.info,
  • make info more useful (per above comments), and
  • update tests?

An alternative is to update the tests to make them pass, but I don't know if that's a good idea.

@TomAugspurger

This comment has been minimized.

Copy link
Contributor Author

commented Nov 30, 2017

I would

  1. Rename Index.summary to Index._summary
  2. Change anywhere in pandas where we currently use Index.summary to Index._summary
  3. Make a new Index.summary that looks like
def summary(self):
    warnings.warn("Index.summary is deprecated and will be removed in a future version")
    return self._summary()
@punzalan

This comment has been minimized.

Copy link

commented Nov 30, 2017

@GGordonGordon

This comment has been minimized.

Copy link
Contributor

commented Mar 5, 2018

@jreback & @TomAugspurger - Are we planning on just deprecating the Index summary method or the DateTimeIndex summary method as well?

@jorisvandenbossche

This comment has been minimized.

Copy link
Member

commented Mar 5, 2018

@GGordonGordon yes, all Index subclasses would deprecate this

@jorisvandenbossche jorisvandenbossche removed the Docs label Mar 5, 2018

@GGordonGordon GGordonGordon referenced this issue Mar 7, 2018

Merged

CLN: Deprecate Index.summary (GH18217) #20028

4 of 4 tasks complete

@jreback jreback modified the milestones: Next Major Release, 0.23.0 Mar 7, 2018

@jsexauer jsexauer referenced this issue Mar 7, 2018

Open

DEPR: deprecations from prior versions #6581

0 of 98 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.