chintan s
chintan s

Reputation: 6488

Pandas: different output from info function

I am reading two different CSV files into dataframes but when I apply info function on them I get different outputs:

df1.info() shows:

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 12173793 entries, 0 to 12173792
Data columns (total 44 columns):
ID                             int64
CODE_x                         object
SECTOR                         object

df2.info() shows:

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 641683 entries, 0 to 641682
Data columns (total 19 columns):
ID                   641683 non-null object
SALE_VALUE           641683 non-null int64
SALE_DATE            641683 non-null object
CODE                 625726 non-null object

Why do I see count of non-null in 2nd DataFrame?

Edit

From the accepted answer below. As I have set these options at start

pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
pd.set_option('float_format', '{:.0f}'.format)

Upvotes: 2

Views: 96

Answers (1)

Ilon
Ilon

Reputation: 89

From the Pandas info documentation:

null_counts : bool, optional

Whether to show the non-null counts. By default, this is shown only if the frame is smaller than pandas.options.display.max_info_rows and pandas.options.display.max_info_columns. A value of True always shows the counts, and False never shows the counts.

So if you do not want to see the null counts, set this value to false for the second data frame like this:

df2.info(null_counts=False)

Upvotes: 3

Related Questions