Spaces:
Runtime error
Runtime error
Commit
·
5a5f8e0
1
Parent(s):
7062a89
app
Browse files
app.py
CHANGED
|
@@ -1,6 +1,8 @@
|
|
| 1 |
import pandas as pd
|
| 2 |
import matplotlib.pyplot as plt
|
| 3 |
import numpy as np
|
|
|
|
|
|
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
|
|
@@ -11,6 +13,18 @@ pd.options.display.max_rows = 300
|
|
| 11 |
def outbreak(plot_type):
|
| 12 |
df = pd.read_csv('emp_experience_data.csv')
|
| 13 |
data_encoded = df.copy(deep=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
if plot_type == "Age Attrition":
|
| 15 |
fig = plt.figure()
|
| 16 |
positive_attrition_df = data_encoded.loc[data_encoded['Attrition'] == "Yes"]
|
|
@@ -29,7 +43,7 @@ def outbreak(plot_type):
|
|
| 29 |
return fig
|
| 30 |
|
| 31 |
inputs = [
|
| 32 |
-
gr.Dropdown(["Age Attrition", "Distance Attrition"], label="
|
| 33 |
]
|
| 34 |
|
| 35 |
outputs = gr.Plot()
|
|
|
|
| 1 |
import pandas as pd
|
| 2 |
import matplotlib.pyplot as plt
|
| 3 |
import numpy as np
|
| 4 |
+
from sklearn.preprocessing import LabelEncoder
|
| 5 |
+
import seaborn as sns
|
| 6 |
|
| 7 |
import gradio as gr
|
| 8 |
|
|
|
|
| 13 |
def outbreak(plot_type):
|
| 14 |
df = pd.read_csv('emp_experience_data.csv')
|
| 15 |
data_encoded = df.copy(deep=True)
|
| 16 |
+
categorical_column = ['Attrition', 'Gender', 'BusinessTravel', 'Education', 'EmployeeExperience', 'EmployeeFeedbackSentiments', 'Designation',
|
| 17 |
+
'SalarySatisfaction', 'HealthBenefitsSatisfaction', 'UHGDiscountProgramUsage', 'HealthConscious', 'CareerPathSatisfaction', 'Region']
|
| 18 |
+
label_encoding = LabelEncoder()
|
| 19 |
+
for col in categorical_column:
|
| 20 |
+
data_encoded[col] = label_encoding.fit_transform(data_encoded[col])
|
| 21 |
+
|
| 22 |
+
if plot_type == "Find Data Correlation":
|
| 23 |
+
fig = plt.figure()
|
| 24 |
+
data_correlation = data_encoded.corr()
|
| 25 |
+
plt.rcParams["figure.figsize"] = [10,10]
|
| 26 |
+
sns.heatmap(data_correlation,xticklabels=data_correlation.columns,yticklabels=data_correlation.columns)
|
| 27 |
+
return fig
|
| 28 |
if plot_type == "Age Attrition":
|
| 29 |
fig = plt.figure()
|
| 30 |
positive_attrition_df = data_encoded.loc[data_encoded['Attrition'] == "Yes"]
|
|
|
|
| 43 |
return fig
|
| 44 |
|
| 45 |
inputs = [
|
| 46 |
+
gr.Dropdown(["Find Data Correlation", "Age Attrition", "Distance Attrition"], label="Data Correlation and Visualization")
|
| 47 |
]
|
| 48 |
|
| 49 |
outputs = gr.Plot()
|