Skip to content

BUG: object of type 'int' has no len() in from_dict function #46092

Closed
@andreapi87

Description

@andreapi87

Pandas version checks

  • I have checked that this issue has not already been reported.

  • I have confirmed this bug exists on the latest version of pandas.

  • I have confirmed this bug exists on the main branch of pandas.

Reproducible Example

d={ 'a': [3,2],'b':2}
pandas.DataFrame.from_dict(d,orient='index')

Issue Description

d={ 'b':2,'a': [3,2],}
pandas.DataFrame.from_dict(d,orient='index')

gives no problem , but if i change the dict order I get I get object of type 'int' has no len()

Expected Behavior

d={ 'b':2,'a': [3,2],}
pandas.DataFrame.from_dict(d,orient='index')

Installed Versions

INSTALLED VERSIONS

commit : 7d32926
python : 3.8.10.final.0
python-bits : 64
OS : Linux
OS-release : 5.4.0-26-generic
Version : #30-Ubuntu SMP Mon Apr 20 16:58:30 UTC 2020
machine : x86_64
processor : x86_64
byteorder : little
LC_ALL : None
LANG : it_IT.UTF-8
LOCALE : it_IT.UTF-8

pandas : 1.2.2
numpy : 1.19.2
pytz : 2021.1
dateutil : 2.8.1
pip : 22.0.2
setuptools : 49.2.1
Cython : None
pytest : None
hypothesis : None
sphinx : None
blosc : None
feather : None
xlsxwriter : None
lxml.etree : 4.6.3
html5lib : 1.1
pymysql : None
psycopg2 : None
jinja2 : 3.0.1
IPython : 7.18.1
pandas_datareader: None
bs4 : None
bottleneck : None
fsspec : None
fastparquet : None
gcsfs : None
matplotlib : 3.3.2
numexpr : None
odfpy : None
openpyxl : None
pandas_gbq : None
pyarrow : None
pyxlsb : None
s3fs : None
scipy : 1.5.2
sqlalchemy : None
tables : None
tabulate : 0.8.9
xarray : None
xlrd : None
xlwt : None
numba : None

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugConstructorsSeries/DataFrame/Index/pd.array ConstructorsDocsNeeds TriageIssue that has not been reviewed by a pandas team memberUsage Question

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions