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

BUG: SparseDataFrame may not preserve passed dtype #13866

Merged
merged 1 commit into from Aug 3, 2016

Conversation

Projects
None yet
3 participants
@sinhrks
Copy link
Member

commented Aug 1, 2016

  • tests added / passed
  • passes git diff upstream/master | flake8 --diff
  • whatsnew entry

SparseDataFrame may reset passed sparse data's dtype and fill_value as below.

on current master:

arr = pd.SparseArray([1, 0, 3, 0], dtype=np.int64, fill_value=0)

# OK, dtype and fill_value are kept
s = pd.SparseSeries(arr, name='x')
s.dtype, s.fill_value
(dtype('int64'), 0)

# NG, dtype is reset
df = pd.SparseDataFrame(s)
df['x'].dtype, df['x'].fill_value
(dtype('float64'), 0)

# NG, dtype is reset
df = pd.SparseDataFrame({'x': s})
df['x'].dtype, df['x'].fill_value
(dtype('float64'), 0)

# NG, dtype and fill_value are reset
df = pd.SparseDataFrame({'x': arr})
df['x'].dtype, df['x'].fill_value
(dtype('float64'), nan)

@sinhrks sinhrks added this to the 0.19.0 milestone Aug 1, 2016

@sinhrks sinhrks force-pushed the sinhrks:sparse_init_dtype branch 2 times, most recently Aug 1, 2016

@codecov-io

This comment has been minimized.

Copy link

commented Aug 2, 2016

Current coverage is 85.28% (diff: 100%)

Merging #13866 into master will decrease coverage by <.01%

@@             master     #13866   diff @@
==========================================
  Files           139        139          
  Lines         50011      50008     -3   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
- Hits          42650      42647     -3   
  Misses         7361       7361          
  Partials          0          0          

Powered by Codecov. Last update 768bf49...dea69ed

@sinhrks sinhrks force-pushed the sinhrks:sparse_init_dtype branch Aug 2, 2016

@sinhrks sinhrks force-pushed the sinhrks:sparse_init_dtype branch to dea69ed Aug 3, 2016

@jreback jreback merged commit caf69d5 into pandas-dev:master Aug 3, 2016

3 checks passed

codecov/patch 100% of diff hit (target 50.00%)
Details
codecov/project 85.28% (target 82.00%)
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@jreback

This comment has been minimized.

Copy link
Contributor

commented Aug 3, 2016

thanks!

@sinhrks sinhrks deleted the sinhrks:sparse_init_dtype branch Aug 3, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.