Spaces:
Build error
Build error
Commit
·
79ea815
1
Parent(s):
55501e5
app
Browse files
app.py
CHANGED
@@ -4,6 +4,7 @@ from sklearn.preprocessing import LabelEncoder
|
|
4 |
|
5 |
def data_description(desc_type):
|
6 |
df = pd.read_csv('emp_experience_data.csv')
|
|
|
7 |
pd.options.display.max_columns = 25
|
8 |
pd.options.display.max_rows = 10
|
9 |
if desc_type == "Display Data":
|
@@ -13,22 +14,21 @@ def data_description(desc_type):
|
|
13 |
data_desc = df_copy.describe()
|
14 |
data_desc.insert(0, "Description", ["count", "mean", "std", "min", "25%", "50%", "75%", "max"], True)
|
15 |
return data_desc
|
16 |
-
if desc_type == "
|
17 |
categorical_column = ['Attrition', 'Gender', 'BusinessTravel', 'Education', 'EmployeeExperience', 'EmployeeFeedbackSentiments', 'Designation', 'SalarySatisfaction',
|
18 |
'HealthBenefitsSatisfaction', 'UHGDiscountProgramUsage', 'HealthConscious', 'CareerPathSatisfaction', 'Region']
|
19 |
-
data_encoded = df.copy(deep=True)
|
20 |
label_encoding = LabelEncoder()
|
21 |
data = [["Feature", "Mapping"]]
|
22 |
-
# Create the pandas DataFrame
|
23 |
for col in categorical_column:
|
24 |
data_encoded[col] = label_encoding.fit_transform(data_encoded[col])
|
25 |
le_name_mapping = dict(zip(label_encoding.classes_, label_encoding.transform(label_encoding.classes_)))
|
26 |
data.append([col, str(le_name_mapping)])
|
27 |
-
#df_dict = pd.DataFrame(data, columns=['Column', 'Mapping'])
|
28 |
return data
|
|
|
|
|
29 |
|
30 |
inputs = [
|
31 |
-
gr.Dropdown(["Display Data", "Describe Data", "
|
32 |
]
|
33 |
|
34 |
outputs = [gr.DataFrame()]
|
|
|
4 |
|
5 |
def data_description(desc_type):
|
6 |
df = pd.read_csv('emp_experience_data.csv')
|
7 |
+
data_encoded = df.copy(deep=True)
|
8 |
pd.options.display.max_columns = 25
|
9 |
pd.options.display.max_rows = 10
|
10 |
if desc_type == "Display Data":
|
|
|
14 |
data_desc = df_copy.describe()
|
15 |
data_desc.insert(0, "Description", ["count", "mean", "std", "min", "25%", "50%", "75%", "max"], True)
|
16 |
return data_desc
|
17 |
+
if desc_type == "Display Encoding":
|
18 |
categorical_column = ['Attrition', 'Gender', 'BusinessTravel', 'Education', 'EmployeeExperience', 'EmployeeFeedbackSentiments', 'Designation', 'SalarySatisfaction',
|
19 |
'HealthBenefitsSatisfaction', 'UHGDiscountProgramUsage', 'HealthConscious', 'CareerPathSatisfaction', 'Region']
|
|
|
20 |
label_encoding = LabelEncoder()
|
21 |
data = [["Feature", "Mapping"]]
|
|
|
22 |
for col in categorical_column:
|
23 |
data_encoded[col] = label_encoding.fit_transform(data_encoded[col])
|
24 |
le_name_mapping = dict(zip(label_encoding.classes_, label_encoding.transform(label_encoding.classes_)))
|
25 |
data.append([col, str(le_name_mapping)])
|
|
|
26 |
return data
|
27 |
+
if desc_type == "Display Encoded Data":
|
28 |
+
return data_encoded.head()
|
29 |
|
30 |
inputs = [
|
31 |
+
gr.Dropdown(["Display Data", "Describe Data", "Display Encoding", "Display Encoded Data"], label="Perform Data Actions")
|
32 |
]
|
33 |
|
34 |
outputs = [gr.DataFrame()]
|