Skip to content

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

3 participants