Search code examples
pythonpandasdebuggingspyder

Incorrect behavior of Spyder or Pandas when calling function DataFrame.info()


I'm using Spyder. Creating some dataframe with Pandas:

import pandas as pd
import numpy.random as npr
npr.seed(0)
df = pd.DataFrame(npr.randint(1, 10, size=(3,4)))

I get a strange behavior when using df.info():

dfi = df.info()

results in printing:

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 3 entries, 0 to 2
Data columns (total 4 columns):
 #   Column  Non-Null Count  Dtype
---  ------  --------------  -----
 0   0       3 non-null      int32
 1   1       3 non-null      int32
 2   2       3 non-null      int32
 3   3       3 non-null      int32
dtypes: int32(4)
memory usage: 180.0 bytes

and the variable is assigned None.

I suspected a package corruption, reinstalled pandas and spyder, same result. Before a painful reset of miniconda, I'd like to know if this is something that can be solved, or at least understood by some testing.


Solution

  • The reaosn for that df.info() provides a concise summary of the df, including its index dtype, column types, etc. and it returns nothing. So,when u define your variable to nothing it will return None