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

Silently ignored kwargs in Index.to_series #18699

Closed
jbrockmendel opened this Issue Dec 8, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@jbrockmendel
Member

jbrockmendel commented Dec 8, 2017

>>> idx = pd.date_range('1994-10-06', freq='D', periods=4)
>>> idx.day.to_series(index=idx)
>>> idx.day.to_series(index=idx)
6    6
7    7
8    8
9    9

Expected:

>>> idx.day.to_series(index=idx)
1994-10-06    6
1994-10-07    7
1994-10-08    8
1994-10-09    9

Looks like Index.to_series takes **kwargs but then ignores them. Should be an easy fix; would be nice to systematically track down other places this might happen.

@jreback

This comment has been minimized.

Contributor

jreback commented Dec 9, 2017

yeah looks like old/typo. should be removable.

@jreback jreback added this to the Next Major Release milestone Dec 9, 2017

@alysivji

This comment has been minimized.

Contributor

alysivji commented Dec 9, 2017

I'm looking into this issue.

Fixed the Index.to_series(**kwargs) bug and added tests to common.py which also contains the original test for this method.

None of the tests in this module are being run:

$ pytest pandas/tests/indexes/common.py
================================= test session starts ==================================
platform darwin -- Python 3.6.1, pytest-3.1.2, py-1.4.34, pluggy-0.4.0
rootdir: /Users/alysivji/Documents/siv-dev/projects/open-source/pandas, inifile: setup.cfg
plugins: xdist-1.17.1
collected 0 items

============================= no tests ran in 0.01 seconds =============================

Where should I be writing my tests?

Note: same bug is also showing up in Index.to_frame(), where index=True is a default kwarg.

>>> import pandas as pd
>>> idx = pd.date_range('1994-10-06', freq='D', periods=4)
>>> idx.day.to_frame()
   0
6  6
7  7
8  8
9  9
@jreback

This comment has been minimized.

Contributor

jreback commented Dec 9, 2017

common is included in all the subclasses

you can add them there

@jreback jreback modified the milestones: Next Major Release, 0.22.0 Dec 10, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment