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

API: DataFrame.__getitem__ returns Series for sparse column #23561

Merged
merged 1 commit into from
Nov 11, 2018

Conversation

TomAugspurger
Copy link
Contributor

Awaiting consensus on #23559, but I went ahead an implemented it.

Breaking API change for

In [1]: import pandas as pd

In [2]: df = pd.DataFrame({"A": pd.SparseSeries([1, 0])})

In [3]: type(df['A'])
Out[3]: pandas.core.sparse.series.SparseSeries

Now Out[3] is a Series.

closes #23559

Breaking API change for

```python
In [1]: import pandas as pd

In [2]: df = pd.DataFrame({"A": pd.SparseSeries([1, 0])})

In [3]: type(df['A'])
Out[3]: pandas.core.sparse.series.SparseSeries
```

Now Out[3] is a Series.

closes pandas-dev#23559
@TomAugspurger TomAugspurger added API Design Sparse Sparse Data Type labels Nov 8, 2018
@TomAugspurger TomAugspurger added this to the 0.24.0 milestone Nov 8, 2018
@pep8speaks
Copy link

Hello @TomAugspurger! Thanks for submitting the PR.

@codecov
Copy link

codecov bot commented Nov 8, 2018

Codecov Report

Merging #23561 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #23561      +/-   ##
==========================================
- Coverage   92.24%   92.24%   -0.01%     
==========================================
  Files         161      161              
  Lines       51224    51218       -6     
==========================================
- Hits        47254    47248       -6     
  Misses       3970     3970
Flag Coverage Δ
#multiple 90.63% <100%> (-0.01%) ⬇️
#single 42.27% <100%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/core/dtypes/concat.py 96.26% <ø> (-0.09%) ⬇️
pandas/core/frame.py 97.03% <100%> (-0.01%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8212001...17ab4f5. Read the comment docs.

@jreback
Copy link
Contributor

jreback commented Nov 8, 2018

lgtm.

@jreback jreback merged commit 43a558f into pandas-dev:master Nov 11, 2018
@jreback
Copy link
Contributor

jreback commented Nov 11, 2018

thanks @TomAugspurger this seems totally reasonable, esp if we are deprecating SparseSeries.

thoo added a commit to thoo/pandas that referenced this pull request Nov 11, 2018
* upstream/master:
  BUG: Casting tz-aware DatetimeIndex to object-dtype ndarray/Index (pandas-dev#23524)
  BUG: Delegate more of Excel parsing to CSV (pandas-dev#23544)
  API: DataFrame.__getitem__ returns Series for sparse column (pandas-dev#23561)
  CLN: use float64_t consistently instead of double, double_t (pandas-dev#23583)
  DOC: Fix Order of parameters in docstrings (pandas-dev#23611)
  TST: Unskip some Categorical Tests (pandas-dev#23613)
  TST: Fix integer ops comparison test (pandas-dev#23619)
  DOC: Fixes to docstring to add validation to CI (pandas-dev#23560)
  DOC: Remove incorrect periods at the end of parameter types (pandas-dev#23600)
  MAINT: tm.assert_raises_regex --> pytest.raises (pandas-dev#23592)
  DOC: Updating Series.resample and DataFrame.resample docstrings (pandas-dev#23197)
thoo added a commit to thoo/pandas that referenced this pull request Nov 12, 2018
…fixed

* upstream/master:
  DOC: Enhancing pivot / reshape docs (pandas-dev#21038)
  TST: Fix xfailing DataFrame arithmetic tests by transposing (pandas-dev#23620)
  BUILD: Simplifying contributor dependencies (pandas-dev#23522)
  BUG/REF: TimedeltaIndex.__new__ (pandas-dev#23539)
  BUG: Casting tz-aware DatetimeIndex to object-dtype ndarray/Index (pandas-dev#23524)
  BUG: Delegate more of Excel parsing to CSV (pandas-dev#23544)
  API: DataFrame.__getitem__ returns Series for sparse column (pandas-dev#23561)
  CLN: use float64_t consistently instead of double, double_t (pandas-dev#23583)
  DOC: Fix Order of parameters in docstrings (pandas-dev#23611)
  TST: Unskip some Categorical Tests (pandas-dev#23613)
  TST: Fix integer ops comparison test (pandas-dev#23619)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Design Sparse Sparse Data Type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DataFrame[sparse].__getitem__ should be Series, not SparseSeries
3 participants