We use the info()
function in the Pandas.DataFrame
module to obtain a concise summary of a given DataFrame.
The info()
function takes the syntax shown below:
DataFrame.info(verbose=None, buf=None, max_cols=None, memory_usage=None, show_counts=None)
The info()
function takes the following optional parameter values:
verbose
(optional): This parameter takes a Boolean value to indicate whether to print the full summary or not.buf
(optional): This is a writable buffer to show where to send the output.memory_usage
(optional): This takes a Boolean value indicating whether the total memory usage of the input DataFrame is to be displayed or not.show_counts
(optional): This takes a Boolean value indicating whether or not to show non-null counts.The info()
function returns a summary of the DataFrame.
Let's view the code example as shown below:
# A code to illustrate the info() function of a DataFrame objectimport pandas as pd# creating a list of objectsint_values = [1, 2, 3, 4, 5]text_values = ['alpha', 'beta', 'gamma', 'delta', 'epsilon']float_values = [0.0, 0.25, 0.5, 0.75, 1.0]# creating a dataframe from the list of objectsdf = pd.DataFrame({"int_column": int_values, "text_column": text_values,"float_col": float_values})# getting the summary of the datafranea = df.info(verbose=True)print(a)
pandas
library.text_values
, int_values
, and float_values
.pandas.DataFrame()
. The name of the DataFrame is df
.a
.a
.