'Why am I getting a TypeError: pandas._libs.missing.isnaobj() when trying to create a df with only column names on Python? Pandas 1.4.0 related
I recently updated my pandas version to 1.4.0, I open Python 3.9.6 to test it out.
I simply wanted to create a df with only column names using the following code
import pandas as pd
#column names
column_names = ["Time", "Currency", "Volatility expected", "Event", "Actual", "Forecast", "Previous"]
#create a dataframe including the column names
df = pd.DataFrame(columns=column_names)
This code was built based on the explanation of this guide.
However, after running the code above, I ended up getting this error:
TypeError: pandas._libs.missing.isnaobj() takes no keyword arguments
I can't figure out where's the problem in the syntax, so I came here to ask and learn about it.
Solution 1:[1]
Your code works perfectly for me. Pandas 1.4.1 and Python 3.9.7
pandas._libs.missing refer to a cython module. Try to upgrade numpy and (not mandatory) install cython package:
[...]$ pip install -U numpy
[...]$ pip install cython
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Corralien |
