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

Series.sort_index(inplace=True) always returns a new Series #11402

Closed
cfperez opened this Issue Oct 21, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@cfperez
Contributor

cfperez commented Oct 21, 2015

Series.index_sort() always returns a new Series, ignoring the inplace keyword argument. This is in contrast to DataFrame's sort_index() which works as expected.

vals = range(10, 0, -1)
x = pd.Series(vals)

# Returns a new Series with the sorted index instead of
# changing x in place
y = x.sort_index(ascending=False, inplace=True)

# Not the same
(x != y).all()

# sort_index() works as expected for DataFrames
xx = pd.DataFrame({'col': x})
assert xx.sort_index(ascending=False, inplace=True) is None

show_versions() output:

INSTALLED VERSIONS

commit: None
python: 3.4.3.final.0
python-bits: 64
OS: Darwin
OS-release: 14.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8

pandas: 0.17.0
nose: 1.3.7
pip: 7.1.2
setuptools: 18.4
Cython: None
numpy: 1.10.1
scipy: 0.16.0
statsmodels: 0.6.1
IPython: 4.0.0
sphinx: None
patsy: 0.4.0
dateutil: 2.4.1
pytz: 2015.6
blosc: None
bottleneck: None
tables: 3.2.2
numexpr: 2.4.4
matplotlib: 1.4.3
openpyxl: 2.2.0-b1
xlrd: 0.9.3
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
httplib2: None
apiclient: None
sqlalchemy: 1.0.3
pymysql: 0.6.6.None
psycopg2: None

@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback Oct 21, 2015

Contributor

prob never implemented

it's pretty trivial to fix (and obviously not tested so need some)
see how .sort_values does it, right above

pull requests welcome!

Contributor

jreback commented Oct 21, 2015

prob never implemented

it's pretty trivial to fix (and obviously not tested so need some)
see how .sort_values does it, right above

pull requests welcome!

@jreback jreback added this to the Next Major Release milestone Oct 21, 2015

@cfperez

This comment has been minimized.

Show comment
Hide comment
@cfperez

cfperez Oct 22, 2015

Contributor

I'm on it!

Contributor

cfperez commented Oct 22, 2015

I'm on it!

@jreback

This comment has been minimized.

Show comment
Hide comment
@jreback

jreback Oct 27, 2015

Contributor

closed by #11422

Contributor

jreback commented Oct 27, 2015

closed by #11422

@jreback jreback closed this Oct 27, 2015

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