-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
43 lines (32 loc) · 1.41 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import pandas as pd
import seaborn as sns
import numpy as np
df = pd.read_csv('data.csv', header=None)
# df = pd.read_csv('data.csv', header=['Plec', 'dlugosc', 'srednica', 'wysokosc', 'masa calkowita', 'masa po wyjęciu z '
# 'muszli',
# 'masa trzewi', 'masa muszli', 'pierścienie'])
# print(df.to_string())
print(df[[0]])
def create_table_count():
table_columns = ["count", "%"]
table_rows = ["Male", "Infant", "Female"]
letters = ['M', 'I', 'F']
data = []
for l in letters:
data.append([df[[0]].value_counts()[l], 100 * df[[0]].value_counts()[l] / df[[0]].count()])
table = pd.DataFrame(data, table_rows, table_columns)
print(table)
def create_table_somtehing():
print(df[[1]].describe()[1:].values)
table_columns = ["mean", "std", 'min', '25%', '50%', '75%', 'max']
table_rows = ["Lengt", "Diameter", "height", "whole weight", "shucked weight", "viscera weight", "shell weight",
"rings"]
data = []
for i in range(1, len(df.columns)):
data.append(df[[i]].describe()[1:].values.reshape({1, 8}))
table = pd.DataFrame(data, table_rows, table_columns)
print(table)
# Press the green button in the gutter to run the script.
if __name__ == '__main__':
# create_table_count()
create_table_somtehing()