w3resource

Pandas DataFrame: info() function

DataFrame - info() function

The info() function is used to print a concise summary of a DataFrame. This method prints information about a DataFrame including the index dtype and column dtypes, non-null values and memory usage.

Syntax:

DataFrame.info(self, verbose=None, buf=None, max_cols=None, memory_usage=None, null_counts=None)

Parameters:

Name Description Type / Default Value Required / Optional
verbose                   Whether to print the full summary. By default, the setting in pandas.options.display.max_info_columns is followed. bool Optional
buf    Where to send the output. By default, the output is printed to sys.stdout. Pass a writable buffer if you need to further process the output. writable buffer
Default Value: defaults to sys.stdout
Required
max_cols   When to switch from the verbose to the truncated output. If the DataFrame has more than max_cols columns, the truncated output is used. By default, the setting in pandas.options.display.max_info_columns is used. int Optional
memory_usage  Specifies whether total memory usage of the DataFrame elements (including the index) should be displayed. By default, this follows the pandas.options.display.memory_usage setting.
True always show memory usage. False never shows memory usage. A value of ‘deep’ is equivalent to “True with deep introspection”. Memory usage is shown in human-readable units (base-2 representation). Without deep introspection a memory estimation is made based in column dtype and number of rows assuming values consume the same memory amount for corresponding dtypes. With deep memory introspection, a real memory usage calculation is performed at the cost of computational resources.
bool, str Optional
null_counts 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. bool Optional

Returns: None
This method prints a summary of a DataFrame and returns None.

Example:


Download the Pandas DataFrame Notebooks from here.

Previous: DataFrame - from_dict() function
Next: DataFrame - to_parquet() function



Follow us on Facebook and Twitter for latest update.