Spaces:
Build error
Build error
Commit
·
1bce424
1
Parent(s):
79ea815
app
Browse files
app.py
CHANGED
|
@@ -4,9 +4,13 @@ from sklearn.preprocessing import LabelEncoder
|
|
| 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":
|
| 11 |
return df.head()
|
| 12 |
if desc_type == "Describe Data":
|
|
@@ -15,9 +19,6 @@ def data_description(desc_type):
|
|
| 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])
|
|
@@ -25,6 +26,8 @@ def data_description(desc_type):
|
|
| 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 = [
|
|
|
|
| 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 |
+
data_encoded = df.copy(deep=True)
|
| 10 |
+
categorical_column = ['Attrition', 'Gender', 'BusinessTravel', 'Education', 'EmployeeExperience', 'EmployeeFeedbackSentiments', 'Designation',
|
| 11 |
+
'SalarySatisfaction', 'HealthBenefitsSatisfaction', 'UHGDiscountProgramUsage', 'HealthConscious', 'CareerPathSatisfaction', 'Region']
|
| 12 |
+
label_encoding = LabelEncoder()
|
| 13 |
+
|
| 14 |
if desc_type == "Display Data":
|
| 15 |
return df.head()
|
| 16 |
if desc_type == "Describe Data":
|
|
|
|
| 19 |
data_desc.insert(0, "Description", ["count", "mean", "std", "min", "25%", "50%", "75%", "max"], True)
|
| 20 |
return data_desc
|
| 21 |
if desc_type == "Display Encoding":
|
|
|
|
|
|
|
|
|
|
| 22 |
data = [["Feature", "Mapping"]]
|
| 23 |
for col in categorical_column:
|
| 24 |
data_encoded[col] = label_encoding.fit_transform(data_encoded[col])
|
|
|
|
| 26 |
data.append([col, str(le_name_mapping)])
|
| 27 |
return data
|
| 28 |
if desc_type == "Display Encoded Data":
|
| 29 |
+
for col in categorical_column:
|
| 30 |
+
data_encoded[col] = label_encoding.fit_transform(data_encoded[col])
|
| 31 |
return data_encoded.head()
|
| 32 |
|
| 33 |
inputs = [
|