Skip to content

Instantly share code, notes, and snippets.

@fuwiak
Last active August 14, 2020 17:01
Show Gist options
  • Save fuwiak/2cc9a9080c5db2f16b4c3b4e8fe05d90 to your computer and use it in GitHub Desktop.
Save fuwiak/2cc9a9080c5db2f16b4c3b4e8fe05d90 to your computer and use it in GitHub Desktop.
data = open("/Users/macbookssd/Desktop/faster_ds/sample_data/titanic.csv", "r")
data = data.read()
data = data.split("\n")
row_data=[]
number_of_lines=0
for row in data:
line = row.split("\t")
row_data.append(line)
number_of_lines+=1
names_of_columns = row_data[0]
suma=0
ile=0
for i in range(1,number_of_lines-1):
if row_data[i][5]!='':
suma+=float(row_data[i][5])
ile+=1
srednia=suma/ile
ile_kobiet=0
for row in row_data[:-1]:
if row[4]=='female':
ile_kobiet+=1
ile_mezczyzn=0
for row in row_data[:-1]:
if row[4]=='male':
ile_mezczyzn+=1
ile_binarnych=0
for row in row_data[1:-1]:
if row[4]!='male' and row[4]!='female':
ile_binarnych+=1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment