xyz / Python program Automated EDA with Generative AI
avra121's picture
Create Python program Automated EDA with Generative AI
89f005e verified
Raw History Blame Contribute Delete
1.09 kB
import pandas as pd
import numpy as np
try:
df = pd.read_csv("dataset.csv")
except FileNotFoundError:
print("dataset.csv not found. Creating a sample DataFrame for demonstration.")
data = {
'Feature1': np.random.rand(100),
'Feature2': np.random.rand(100) * 10,
'Feature3': np.random.randint(1, 100, 100),
'Target': np.random.choice([0, 1], 100)
}
df = pd.DataFrame(data)
df.loc[df.sample(frac=0.05).index, 'Feature1'] = np.nan
print("Dataset Shape:", df.shape)
print("\nData Types:\n", df.dtypes)
missing = df.isnull().sum()
print("\nMissing Values:\n", missing)
if missing.sum() == 0:
print("GenAI Insight: Dataset has no missing values.")
else:
print("GenAI Insight: Missing values found, data cleaning required.")
print("\nStatistical Summary:\n", df.describe())
corr = df.corr(numeric_only=True)
print("\nCorrelation Matrix:\n", corr)
if (corr.abs() > 0.7).any().any():
print("GenAI Insight: Strong correlation exists between some features.")
else:
print("GenAI Insight: No strong correlation detected.")