verbose | Bool,optional, to print full summary or exclude about columns. It follows the setting at pandas.options.display.max_info_columns (default = 100 ) |
buf | Output to write to buffer. default is sys.stdout |
max_cols | Int ,When to switch from the verbose to the truncated output |
memory_usage | Minimum value appearing in the column |
null_counts | 25th percentile of objects in the column |
import pandas as pd
my_dict={
'NAME':['Ravi','Raju','Alex'],
'ID':[1,2,3],'MATH':[30,40,50],
'ENGLISH':[20,30,40]
}
my_data = pd.DataFrame(data=my_dict)
print(my_data.info())
Output
RangeIndex: 3 entries, 0 to 2
Data columns (total 4 columns):
NAME 3 non-null object
ID 3 non-null int64
MATH 3 non-null int64
ENGLISH 3 non-null int64
dtypes: int64(3), object(1)
memory usage: 176.0+ bytes
None
We will use verbose=False and check the output ( we will get same output as above if we use verbose=True)
my_data.info(verbose=False)
Output
RangeIndex: 3 entries, 0 to 2
Columns: 4 entries, NAME to ENGLISH
dtypes: int64(3), object(1)
memory usage: 176.0+ bytes
Above output depends on the Pandas setting , check details like here.
print(pd.options.display.max_info_columns) # 100
max_cols=4 the full summary will be displayed.
my_data.info(max_cols=3)
Output
RangeIndex: 3 entries, 0 to 2
Columns: 4 entries, NAME to ENGLISH
dtypes: int64(3), object(1)
memory usage: 176.0+ bytes
Let us change the value to max_cols=4
my_data.info(max_cols=4)
The output is full details like shown above ( first display of code )
my_data.info(memory_usage='deep')
Author & Instructor at plus2net
I write and maintain practical tutorials on Python, PHP, SQL, JavaScript, HTML, jQuery, and web development at plus2net. The tutorials focus on clear explanations, working examples, and code that readers can test and adapt while learning.