-
- Notifications
You must be signed in to change notification settings - Fork 19.4k
Closed
Labels
ExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.ReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, ExplodeSparseSparse Data TypeSparse Data Type
Milestone
Description
Code Sample, a copy-pastable example if possible
import pandas as pd pd.DataFrame().astype(pd.SparseDtype(float))Problem description
Converting an empty dataframe to a sparse representation leads to a ValueError.
ValueError: No objects to concatenate Expected Output
I expected this to work even though the dataframe is empty.
Output of pd.show_versions()
>>> pandas.show_versions() INSTALLED VERSIONS ------------------ commit : None python : 3.7.4.final.0 python-bits : 64 OS : Darwin OS-release : 19.0.0 machine : x86_64 processor : i386 byteorder : little LC_ALL : en_US.UTF-8 LANG : en_US.UTF-8 LOCALE : en_US.UTF-8 pandas : 1.0.3 numpy : 1.18.2 pytz : 2019.3 dateutil : 2.8.1 pip : 19.3.1 setuptools : 45.0.0 Cython : None pytest : 5.2.2 hypothesis : None sphinx : None blosc : None feather : None xlsxwriter : None lxml.etree : 4.4.2 html5lib : None pymysql : None psycopg2 : None jinja2 : 2.10.3 IPython : 7.11.1 pandas_datareader: None bs4 : None bottleneck : None fastparquet : None gcsfs : None lxml.etree : 4.4.2 matplotlib : 3.1.2 numexpr : 2.7.0 odfpy : None openpyxl : None pandas_gbq : None pyarrow : None pytables : None pytest : 5.2.2 pyxlsb : None s3fs : None scipy : 1.4.1 sqlalchemy : None tables : 3.6.0 tabulate : None xarray : None xlrd : 1.2.0 xlwt : None xlsxwriter : None numba : 0.46.0 Metadata
Metadata
Assignees
Labels
ExtensionArrayExtending pandas with custom dtypes or arrays.Extending pandas with custom dtypes or arrays.ReshapingConcat, Merge/Join, Stack/Unstack, ExplodeConcat, Merge/Join, Stack/Unstack, ExplodeSparseSparse Data TypeSparse Data Type