Closed
Description
This isn't a huge deal, but it seems a little odd:
In [1]: import pandas as pd
In [2]: a = pd.SparseArray([True, False, False, False, True], fill_value=False, dtype=bool)
In [3]: a
Out[3]:
[True, False, False, False, True]
Fill: False
IntIndex
Indices: array([0, 4], dtype=int32)
In [4]: a.dtype
Out[4]: dtype('bool')
In [5]: d = a.to_dense()
In [6]: d
Out[6]: array([ 1., 0., 0., 0., 1.])
In [7]: d.dtype
Out[7]: dtype('float64')
I would have expected d
to retain the dtype of bool
. I can cast down, but I am still wasting 7 bytes per element in the process.