Spaces:
Runtime error
Runtime error
Commit
·
2717a3c
1
Parent(s):
eadb45e
fixed onehotencoder issue1.0
Browse files
app.py
CHANGED
|
@@ -26,8 +26,7 @@ def main():
|
|
| 26 |
<div style="background-color:pink;"><p style="color:white;font-size:75px;padding:10px">Room Occupancy Predictor 💡</p></div>
|
| 27 |
"""
|
| 28 |
st.markdown(html_temp,unsafe_allow_html=True)
|
| 29 |
-
|
| 30 |
-
st.balloons()
|
| 31 |
|
| 32 |
def file_selector(folder_path='./dataset'):
|
| 33 |
filenames = os.listdir(folder_path)
|
|
@@ -156,6 +155,10 @@ def main():
|
|
| 156 |
imp = SimpleImputer(missing_values = np.nan, strategy="mean")
|
| 157 |
df.loc[:,df.dtypes != 'object'] = imp.fit_transform(df.loc[:,df.dtypes != 'object'])
|
| 158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 159 |
# One hot encoding for categorical variables
|
| 160 |
|
| 161 |
features = st.multiselect('select features and target variable',df.columns.tolist())
|
|
@@ -166,7 +169,7 @@ def main():
|
|
| 166 |
df.loc[:,x] = le.fit_transform(df[x])
|
| 167 |
onehotencoder = OneHotEncoder()
|
| 168 |
df.loc[:,~cats].join(pd.DataFrame(data=onehotencoder.
|
| 169 |
-
fit_transform (df.loc[:,cats]).toarray(), columns=onehotencoder.
|
| 170 |
|
| 171 |
chosen_target = st.sidebar.selectbox("Please choose target column", (df.columns))
|
| 172 |
|
|
|
|
| 26 |
<div style="background-color:pink;"><p style="color:white;font-size:75px;padding:10px">Room Occupancy Predictor 💡</p></div>
|
| 27 |
"""
|
| 28 |
st.markdown(html_temp,unsafe_allow_html=True)
|
| 29 |
+
|
|
|
|
| 30 |
|
| 31 |
def file_selector(folder_path='./dataset'):
|
| 32 |
filenames = os.listdir(folder_path)
|
|
|
|
| 155 |
imp = SimpleImputer(missing_values = np.nan, strategy="mean")
|
| 156 |
df.loc[:,df.dtypes != 'object'] = imp.fit_transform(df.loc[:,df.dtypes != 'object'])
|
| 157 |
|
| 158 |
+
|
| 159 |
+
if st.button("Thanks"):
|
| 160 |
+
st.balloons()
|
| 161 |
+
|
| 162 |
# One hot encoding for categorical variables
|
| 163 |
|
| 164 |
features = st.multiselect('select features and target variable',df.columns.tolist())
|
|
|
|
| 169 |
df.loc[:,x] = le.fit_transform(df[x])
|
| 170 |
onehotencoder = OneHotEncoder()
|
| 171 |
df.loc[:,~cats].join(pd.DataFrame(data=onehotencoder.
|
| 172 |
+
fit_transform (df.loc[:,cats]).toarray(), columns=onehotencoder.get_feature_names_out()))
|
| 173 |
|
| 174 |
chosen_target = st.sidebar.selectbox("Please choose target column", (df.columns))
|
| 175 |
|