2 no 0 female 3 no 1 male 4 yes 1 male 5 no 1 female 6 no 2 female 7 no 1 male 8 no 2 male 9 no 2 male 10 no 1 male 11 no 0 female """ data = StringIO(data) data.seek(0) data = pd.read_csv(data, sep=' ', skipinitialspace=True, index_col='PersonID') data.info() # %% """ genero la tabella dei conteggi """ data_ = data.copy() data_['Intercept'] = 1 info_df_ = data_.groupby(['Sex', 'No_of_Children', 'Married'])['Intercept'].count() print(info_df_) # %% url = "http://facweb.cs.depaul.edu/mobasher/classes/csc478/Data/titanic-trimmed.csv" titanic = pd.read_csv(url) titanic.head(10) titanic['Intercept'] = 1 titanic['survived'] = titanic['survived'].replace({0:'No', 1:'Yes'})