changed .ipynb to .py

This commit is contained in:
Jakub Henyk 2023-04-04 13:58:30 +02:00
parent b55bd7f76d
commit a70a6ebc96
2 changed files with 37 additions and 3 deletions

View File

@ -11,8 +11,8 @@ RUN apt-get install -y python3
RUN apt-get install -y python3-pip RUN apt-get install -y python3-pip
RUN python3 -m pip install pandas RUN python3 -m pip install pandas
COPY ./zadanie1.ipynb ./ COPY ./zadanie1.py ./
RUN chmod +x ./zadanie1.ipynb RUN chmod +x ./zadanie1.py
CMD ./zadanie1.ipynb CMD ./zadanie1.py

34
zadanie1.py Normal file
View File

@ -0,0 +1,34 @@
import pandas as pd
import numpy as np
data = pd.read_csv("Customers.csv")
print(data[:10])
dataF = data
mapping = {'NaN' : 0, 'Healthcare' : 1, 'Engineer' : 2, 'Lawyer' : 3, 'Entertainment' : 4, 'Artist' : 5, 'Executive' : 6,
'Doctor' : 7, 'Homemaker' : 8, 'Marketing' : 9}
mapping2 = {'Male' : 0, 'Female' : 1}
dataF = dataF.replace({'Profession': mapping})
dataF = dataF.replace({'Gender': mapping2})
dataF = dataF.drop(columns=['CustomerID'])
dataF['Profession'] = dataF['Profession'].fillna(0)
normalized_dataF = (dataF - dataF.min())/(dataF.max() - dataF.min())
print(normalized_dataF[:10])
train_data = normalized_dataF[0:1600]
dev_data = normalized_dataF[1600:1800]
test_data = normalized_dataF[1800:]
print(f"Wielkość zbioru Customers: {len(data)} elementów")
print(f"Wielkość zbioru trenującego: {len(train_data)} elementów")
print(f"Wielkość zbioru walidującego: {len(dev_data)} elementów")
print(f"Wielkość zbioru testującego: {len(test_data)} elementów")
print(f" \nDane i wartości na temat zbioru: \n \n {normalized_dataF.describe()}")