BUG: SparseDataFrame construction with lists not coercing to dtype #15682

Closed
jreback opened this Issue Mar 14, 2017 · 2 comments

Comments

Projects
None yet
2 participants
Contributor

jreback commented Mar 14, 2017

coercion happens

In [12]: df = pd.SparseDataFrame({'a': [1, 0, 0],
    ...:                          'b': [0, 1, 0],
    ...:                          'c': [0, 0, 1]}, dtype='uint8', default_fill_value=0)

In [13]: df.dtypes
Out[13]: 
a    int64
b    int64
c    int64
dtype: object

respected here

In [23]: df = pd.SparseDataFrame({'a': pd.SparseSeries([1, 0, 0], dtype='uint8'),
    ...:                          'b': pd.SparseSeries([0, 1, 0], dtype='uint8'),
    ...:                          'c': pd.SparseSeries([0, 0, 1], dtype='uint8')}, default_fill_value=0)

In [24]: df.dtypes
Out[24]: 
a    uint8
b    uint8
c    uint8
dtype: object

In [25]: df.default_fill_value
Out[25]: 0

And here

In [15]: df = pd.DataFrame({'a': [1, 0, 0],
    ...:                          'b': [0, 1, 0],
    ...:                          'c': [0, 0, 1]}, dtype='uint8').to_sparse(fill_value=0)

In [17]: df.dtypes
Out[17]: 
a    uint8
b    uint8
c    uint8
dtype: object

In [18]: df.default_fill_value
Out[18]: 0

jreback added this to the 0.20.0 milestone Mar 14, 2017

@jreback jreback modified the milestone: 0.20.0, Next Major Release Mar 23, 2017

Contributor

ucals commented Mar 28, 2017

As the last one we did was about types, I'd like to try this one :)

Contributor

jreback commented Mar 28, 2017

@ucals sure!

@jreback jreback modified the milestone: 0.20.0, Next Major Release Mar 30, 2017

jreback closed this in 1e0fbd2 Mar 30, 2017

@mattip mattip added a commit to mattip/pandas that referenced this issue Apr 3, 2017

@ucals @mattip ucals + mattip BUG: SparseDataFrame construction with lists not coercing to dtype (G…
…H 15682)


closes #15682

Author: Carlos Souza <carlos@udacity.com>

Closes #15834 from ucals/bug-fix-15682 and squashes the following commits:

04fba8d [Carlos Souza] Adding test_rename test cases (were missing)
483bb2c [Carlos Souza] Doing adjustments as per @jreback requests
cc4c15b [Carlos Souza] Fixing coersion bug at SparseDataFrame construction
faa5c5c [Carlos Souza] Merge remote-tracking branch 'upstream/master'
43456a5 [Carlos Souza] Merge remote-tracking branch 'upstream/master'
8b463cb [Carlos Souza] Merge remote-tracking branch 'upstream/master'
9fc617b [Carlos Souza] Merge remote-tracking branch 'upstream/master'
e12bca7 [Carlos Souza] Sync fork
676a4e5 [Carlos Souza] Test
ffb49b4

@linebp linebp added a commit to linebp/pandas that referenced this issue Apr 17, 2017

@ucals @linebp ucals + linebp BUG: SparseDataFrame construction with lists not coercing to dtype (G…
…H 15682)


closes #15682

Author: Carlos Souza <carlos@udacity.com>

Closes #15834 from ucals/bug-fix-15682 and squashes the following commits:

04fba8d [Carlos Souza] Adding test_rename test cases (were missing)
483bb2c [Carlos Souza] Doing adjustments as per @jreback requests
cc4c15b [Carlos Souza] Fixing coersion bug at SparseDataFrame construction
faa5c5c [Carlos Souza] Merge remote-tracking branch 'upstream/master'
43456a5 [Carlos Souza] Merge remote-tracking branch 'upstream/master'
8b463cb [Carlos Souza] Merge remote-tracking branch 'upstream/master'
9fc617b [Carlos Souza] Merge remote-tracking branch 'upstream/master'
e12bca7 [Carlos Souza] Sync fork
676a4e5 [Carlos Souza] Test
cd94c0a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment