SimpleEDA is a Python library for simple exploratory data analysis tasks. It provides functions to handle outliers, find special characters, calculate Variance Inflation Factor (VIF), detect duplicates, and visualize continuous data using box plots.
You can install SimpleEDA via pip:
pip install SimpleEDA
Below are examples of how to use the various functions provided by SimpleEDA.
import SimpleEDA as eda
import pandas as pd
# Sample DataFrame
df = pd.DataFrame({
'A': [1, 2, 2, 4, 5, 6, 7, 8, 9, 10],
'B': [11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
'C': [21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
'D': ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
})
This function removes outliers from a column based on the Interquartile Range (IQR) method.
lower, upper = eda.remove_outlier(df['A'])
print(f"Lower bound: {lower}, Upper bound: {upper}")
Parameters:
-
col
(pd.Series): The column from which to remove outliers. -
multiplier
(float): The multiplier for the IQR to define outliers. Default is 1.5.
Returns:
-
tuple
: Lower and upper range for outlier detection.
This function finds special characters in a DataFrame.
eda.find_specialchar(df)
Parameters:
-
df
(pd.DataFrame): The DataFrame to check.
Returns:
- None
This function calculates the Variance Inflation Factor (VIF) for each feature in the DataFrame.
eda.vif_cal(df[['A', 'B', 'C']])
Parameters:
-
input_data
(pd.DataFrame): The DataFrame for which to calculate VIF.
Returns:
- None
This function shows a duplicate summary of a DataFrame.
eda.dups(df)
Parameters:
-
df
(pd.DataFrame): The DataFrame to check for duplicates.
Returns:
- None
This function plots boxplots for all continuous features in the DataFrame.
eda.boxplt_continous(df)
Parameters:
-
df
(pd.DataFrame): The DataFrame to plot.
Returns:
- None
Here's a complete example of using SimpleEDA with a sample DataFrame:
import SimpleEDA as eda
import pandas as pd
# Sample DataFrame
df = pd.DataFrame({
'A': [1, 2, 2, 4, 5, 6, 7, 8, 9, 10],
'B': [11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
'C': [21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
'D': ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
})
# Remove outliers
lower, upper = eda.remove_outlier(df['A'])
print(f"Lower bound: {lower}, Upper bound: {upper}")
# Find special characters
eda.find_specialchar(df)
# Calculate VIF
eda.vif_cal(df[['A', 'B', 'C']])
# Detect duplicates
eda.dups(df)
# Plot boxplots for continuous features
eda.boxplt_continous(df)
Provides an enhanced summary of a pandas DataFrame, including custom percentiles, IQR, outliers, duplicates, missing values, and skewness. It also handles both numerical and categorical variables.
summary = eda.enhance_summary(df, custom_percentiles=[5, 95])
print(summary)
dataframe (pd.DataFrame): The DataFrame to summarize. custom_percentiles (list, optional): A list of custom percentiles to include in the summary.
pd.DataFrame: DataFrame containing the enhanced summary statistics.
Here's a complete example of using SimplyEDA with a sample DataFrame:
import SimplyEDA as eda
import pandas as pd
# Sample DataFrame
df = pd.DataFrame({
'A': [1, 2, 2, 4, 5, 6, 7, 8, 9, 10],
'B': [11, 12, 13, 14, 15, 16, 17, 18, 19, 20],
'C': [21, 22, 23, 24, 25, 26, 27, 28, 29, 30],
'D': ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j']
})
# Remove outliers
lower, upper = eda.remove_outlier(df['A'])
print(f"Lower bound: {lower}, Upper bound: {upper}")
# Find special characters
eda.find_specialchar(df)
# Calculate VIF
vif = eda.vif_cal(df[['A', 'B', 'C']])
print(vif)
# Detect duplicates
eda.dups(df)
# Plot boxplots for continuous features
eda.boxplt_continous(df)
# Enhanced summary
summary = eda.enhance_summary(df, custom_percentiles=[5, 95])
print(summary)
This project was created by M.R.Vijay Krishnan. You can reach me at vijaykrishnanmr@gmail.com.
This project is licensed under the MIT License - see the LICENSE file for details.