We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
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
import pandas pandas.SparseDataFrame(pandas.Series())
I've seen there are plans to SparseDataFrame. But reporting anyway.
The above code, creating a SparseDataFrame with a dense Series fails with a not very descriptive error:
SparseDataFrame
Series
--------------------------------------------------------------------------- UnboundLocalError Traceback (most recent call last) <ipython-input-6-b9708ff05a7c> in <module>() 1 import pandas 2 ----> 3 pandas.SparseDataFrame(pandas.Series()) ~/anaconda3/lib/python3.6/site-packages/pandas/core/sparse/frame.py in __init__(self, data, index, columns, default_kind, default_fill_value, dtype, copy) 120 mgr = mgr.astype(dtype) 121 --> 122 generic.NDFrame.__init__(self, mgr) 123 124 @property UnboundLocalError: local variable 'mgr' referenced before assignment
Any other type provided to the constructor fails with the same error.
I'd expect an empty series (if the dense Series has a name, or columns is provided).
Or a useful error message, if the data type is not accepted.
pd.show_versions()
commit: None python: 3.6.4.final.0 python-bits: 64 OS: Linux OS-release: 4.14.13-300.fc27.x86_64 machine: x86_64 processor: x86_64 byteorder: little LC_ALL: None LANG: en_GB.utf8 LOCALE: en_GB.UTF-8
pandas: 0.23.0.dev0+152.g2952fbd55.dirty pytest: 3.3.0 pip: 9.0.1 setuptools: 36.5.0.post20170921 Cython: 0.27.3 numpy: 1.13.3 scipy: 1.0.0 pyarrow: 0.7.1 xarray: None IPython: 6.2.1 sphinx: 1.6.3 patsy: 0.4.1 dateutil: 2.6.1 pytz: 2017.3 blosc: None bottleneck: 1.2.1 tables: 3.4.2 numexpr: 2.6.4 feather: None matplotlib: 2.1.1 openpyxl: 2.4.9 xlrd: 1.1.0 xlwt: 1.3.0 xlsxwriter: 1.0.2 lxml: 4.1.1 bs4: 4.6.0 html5lib: 1.0.1 sqlalchemy: 1.1.13 pymysql: None psycopg2: None jinja2: 2.10 s3fs: None fastparquet: None pandas_gbq: None pandas_datareader: None
The text was updated successfully, but these errors were encountered:
BUG adding support for dense Series in the SparseDataFrame constructo…
eec7f57
…r, and providing useful error messages for other types (#19374) (#19377)
Successfully merging a pull request may close this issue.
Code Sample, a copy-pastable example if possible
Problem description
I've seen there are plans to SparseDataFrame. But reporting anyway.
The above code, creating a
SparseDataFrame
with a denseSeries
fails with a not very descriptive error:Any other type provided to the constructor fails with the same error.
Expected Output
I'd expect an empty series (if the dense
Series
has a name, or columns is provided).Or a useful error message, if the data type is not accepted.
Output of
pd.show_versions()
INSTALLED VERSIONS
commit: None
python: 3.6.4.final.0
python-bits: 64
OS: Linux
OS-release: 4.14.13-300.fc27.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: None
LANG: en_GB.utf8
LOCALE: en_GB.UTF-8
pandas: 0.23.0.dev0+152.g2952fbd55.dirty
pytest: 3.3.0
pip: 9.0.1
setuptools: 36.5.0.post20170921
Cython: 0.27.3
numpy: 1.13.3
scipy: 1.0.0
pyarrow: 0.7.1
xarray: None
IPython: 6.2.1
sphinx: 1.6.3
patsy: 0.4.1
dateutil: 2.6.1
pytz: 2017.3
blosc: None
bottleneck: 1.2.1
tables: 3.4.2
numexpr: 2.6.4
feather: None
matplotlib: 2.1.1
openpyxl: 2.4.9
xlrd: 1.1.0
xlwt: 1.3.0
xlsxwriter: 1.0.2
lxml: 4.1.1
bs4: 4.6.0
html5lib: 1.0.1
sqlalchemy: 1.1.13
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
The text was updated successfully, but these errors were encountered: