Home > Software engineering >  Why am I getting a TypeError: pandas._libs.missing.isnaobj() when trying to create a df with only co
Why am I getting a TypeError: pandas._libs.missing.isnaobj() when trying to create a df with only co

Time:03-12

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.

CodePudding user response:

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
  • Related