pyeda31.data_summary
Functions
|
Generate summary statistics for specified columns or all columns if none are provided. |
Module Contents
- pyeda31.data_summary.get_summary_statistics(df, col=None, decimal=3)[source]
Generate summary statistics for specified columns or all columns if none are provided.
This function will return the important statistics (including mean, min, max, median, mode, and range) for numeric columns, as well as key metrics (including number of unique values, the most frequent value, and its corresponding frequency) for non-numeric columns.
- Parameters:
df (pd.DataFrame) – The dataframe containing the data for analysis.
col (list, optional) – A list of column names for which to get statistics. Default value is None, the function will apply for all columns.
decimals (int, optional) – The number of decimal places to round the mean value. Default value is 3, the function will round the mean numerical value to 3 decimal places.
- Returns:
A DataFrame with summary statistics for the specified columns, including mean, min, max, median, mode, and range for numeric columns, as well as number of unique values, the most frequent value, and its corresponding frequency) for non-numeric columns.
- Return type:
pd.DataFrame
Examples
>>> from pyeda31.data_summary import get_summary_statistics >>> get_summary_statistics(df) >>> get_summary_statistics(df, col=["numeric", "categorical"]) >>> get_summary_statistics(df, col=["numeric"], decimal = 2)