Skip to content

BUG: SparseSeries.abs() resets name #10241

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 1 commit into from
Jun 2, 2015

Conversation

sinhrks
Copy link
Member

@sinhrks sinhrks commented May 30, 2015

# OK: name is preserved
s = pd.Series([1, 2, -3], name='a')
s.abs()
#0    1
#1    2
#2    3
# Name: a, dtype: int64

# NG: name is reset
s = pd.SparseSeries([1, 0, -3], name='a')
s.name
# 'a'

s.abs()
#0    1
#1    0
#2    3
# dtype: int64
# BlockIndex
# Block locations: array([0], dtype=int32)
# Block lengths: array([3], dtype=int32)

@jreback
Copy link
Contributor

jreback commented May 30, 2015

this might be more general in sparse (I mean that it's not propagating meta data )

@sinhrks
Copy link
Member Author

sinhrks commented May 30, 2015

Looked through other methods, and found others call __finalize__ after _constractor. Thus hopefully OK. I'm working on assert_series_equal to check Series name. If any problem found, I'll prepare a separate fix.

Changed abs to use __finalize__ also.

@sinhrks sinhrks added the Bug label May 31, 2015
@sinhrks sinhrks added this to the 0.17.0 milestone May 31, 2015
@jreback
Copy link
Contributor

jreback commented Jun 2, 2015

lgtm

jreback added a commit that referenced this pull request Jun 2, 2015
BUG: SparseSeries.abs() resets name
@jreback jreback merged commit 08d60e6 into pandas-dev:master Jun 2, 2015
@jreback
Copy link
Contributor

jreback commented Jun 2, 2015

thanks!

@sinhrks sinhrks deleted the sparseabs_name branch June 2, 2015 12:48
@jorisvandenbossche jorisvandenbossche modified the milestones: 0.17.0, 0.16.2 Jun 2, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants