python-3.xpandaspython-3.6pandas-profilingdata-profiling

when i execute pandas-profiling package it won't return min, max and mean values


When i profiling the following data using pandas-profiling==2.8.0 it won't return min, max and mean values.

CSV data

a,b,c
12,2.5,0
12,4.7,5
33,5,4
44,44.21,67

python code

import json
import pandas as pd
from pandas_profiling import ProfileReport

def profile_report(data):
    dataset = data.select_dtypes(include=['int64', 'float64'])  
    profile=ProfileReport(dataset, minimal=True)
    json_data=profile.to_json()
    results = json.loads(json_data)
    print(json.dumps(results, indent=4))

if __name__ == "__main__":
    df = pd.read_csv('data.csv',index_col=None)
    profile_report(df)

in some case it work properly and return min, max and mean values. but when i execute above csv data it won't return that values


Solution

  • For a dataset with less elements than a given number (say 5), pandas-profiling assumes that your variable is categorical instead of interval.

    Use the vars.num.low_categorical_threshold parameter to change this (docs)

    Example:

    profile = ProfileReport(dataset, minimal=True, vars=dict(num={"low_categorical_threshold": 0}))