pandas-dev / pandas

Flexible and powerful data analysis / manipulation library for Python, providing labeled data structures similar to R data.frame objects, statistical functions, and much more
https://pandas.pydata.org
BSD 3-Clause "New" or "Revised" License
43.83k stars 18k forks source link

BUG: DataFrame Dict not callabe #60086

Open kellykayaks opened 1 month ago

kellykayaks commented 1 month ago

Pandas version checks

Reproducible Example

import pandas as pd

d = {'col1': [1,3], 'col2': [4,5]}
df = pd.DataFrame(data=d)
print(df)

  File ~\anaconda3\Lib\site-packages\spyder_kernels\py3compat.py:356 in compat_exec
    exec(code, globals, locals)

  File c:\dennis\savedennis\f\pythonstocks\code\untitled3.py:10
    df = pd.DataFrame(data=d)

TypeError: 'dict' object is not callable

Issue Description

Everything worked fine until a couple of days ago

Expected Behavior

This code is exactly copied from your examples

Installed Versions

INSTALLED VERSIONS ------------------ commit : a671b5a8bf5dd13fb19f0e88edc679bc9e15c673 python : 3.11.7.final.0 python-bits : 64 OS : Windows OS-release : 10 Version : 10.0.22631 machine : AMD64 processor : Intel64 Family 6 Model 140 Stepping 2, GenuineIntel byteorder : little LC_ALL : None LANG : en LOCALE : English_United States.1252 pandas : 2.1.4 numpy : 1.26.4 pytz : 2023.3.post1 dateutil : 2.8.2 setuptools : 68.2.2 pip : 23.3.1 Cython : None pytest : 7.4.0 hypothesis : None sphinx : 5.0.2 blosc : None feather : None xlsxwriter : None lxml.etree : 4.9.3 html5lib : 1.1 pymysql : None psycopg2 : None jinja2 : 3.1.3 IPython : 8.20.0 pandas_datareader : None bs4 : 4.12.2 bottleneck : 1.3.7 dataframe-api-compat: None fastparquet : None fsspec : 2023.10.0 gcsfs : None matplotlib : 3.8.0 numba : 0.59.0 numexpr : 2.8.7 odfpy : None openpyxl : 3.0.10 pandas_gbq : None pyarrow : 14.0.2 pyreadstat : None pyxlsb : None s3fs : 2023.10.0 scipy : 1.11.4 sqlalchemy : 2.0.25 tables : 3.9.2 tabulate : 0.9.0 xarray : 2023.6.0 xlrd : None zstandard : 0.19.0 tzdata : 2023.3 qtpy : 2.4.1 pyqt5 : None Replace this line with the output of pd.show_versions()
rhshadrach commented 3 weeks ago

I suspect something is wrong with your Python environment. This works fine on my end and would be extremely surprising if it did not. Can you try recreating your Python environment.

What is the output of dir(pd.DataFrame)?