saurabh
saurabh

Reputation: 71

How to fix "module 'pandas' has no attribute 'Int64Dtype' " error in python?

I am trying to execute a code, but i am getting an error.

import pandas as pd

import numpy as np

pd.Series([1, 2, np.nan, 4], dtype=pd.Int64Dtype())

I expect the output as:

Out[14]: 
0        1    
1        2    
2       NaN    
3        4

dtype: Int64

Upvotes: 7

Views: 5414

Answers (2)

Dheeraj
Dheeraj

Reputation: 1

try using np.int64 by importing numpy as np or you can also try by typing pip install --upgrade pandas in your terminal or command prompt

Upvotes: 0

Anjali Dadhich
Anjali Dadhich

Reputation: 21

It might be due to wrong installation or older version as I tried the same and it's working

Upvotes: 1

Related Questions