From 041339a0f3b5dfc4b73b59e7583a2d661a6bede7 Mon Sep 17 00:00:00 2001 From: MatOgr Date: Wed, 11 May 2022 19:10:26 +0200 Subject: [PATCH] Sacred & pymongo install + data normalization fix --- requirements.txt | 4 +++- scripts/grab_avocado.py | 8 ++++++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/requirements.txt b/requirements.txt index 12c9edd..372577e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -3,4 +3,6 @@ pandas numpy sklearn torch -matplotlib \ No newline at end of file +matplotlib +sacred +pymongo \ No newline at end of file diff --git a/scripts/grab_avocado.py b/scripts/grab_avocado.py index 342d036..e9bd522 100644 --- a/scripts/grab_avocado.py +++ b/scripts/grab_avocado.py @@ -6,7 +6,10 @@ cols = list(pd.read_csv("data/avocado.csv", nrows=1)) # print("###\n", cols, "\n###") avocados = pd.read_csv( "data/avocado.csv").rename(columns={"Unnamed: 0": 'Week'}) -avocados.describe(include="all") +print(avocados.describe(include="all")) +avg_prices = avocados['AveragePrice'] +avocados.drop(['AveragePrice'], axis=1, inplace=True) + # * Retrieve the target column # y = avocados.AveragePrice @@ -43,7 +46,8 @@ print(all_cols) # avocados = pd.concat([avocados, ohe_df], axis=1) # * Time for normalization mM = MinMaxScaler() -avocados_normed = pd.DataFrame(mM.fit_transform(avocados.values), columns=all_cols) +avocados_normed = pd.concat([avg_prices, pd.DataFrame( + mM.fit_transform(avocados.values), columns=all_cols)], axis=1) print(avocados_normed.head())