On page 2/14
I don’t understand in the definition of the function explore_data
print(‘Number of rows:’, len(dataset))
print(‘Number of columns:’, len(dataset))
I understand all the results we get and the function itself but I can’t picture len(dataset) and len(dataset) or the logic behind those two arguments in the dataset itself: how does len (dataset) matches to number of rows or len (dataset) to the number of columns.
Hello @gaelle.c the data set is a list of list, therefore each list is a is a row. To get the total number of rows of the dataset,
len(dataset) will be used.
since each list in the data set list of list is a row, to get the total number of column in the dataset is well need to calculate the length of any row therefore
len(dataset) is used.
If you have any question feel free to ask me.
Thank you for your reply.
The len(dataset) part makes sense now, we did use it previously to get number of rows so I get it. However the len(dataset) is still bugging me. In previous chapters it would have been the row header and cant picture how we get the number of columns from it
Great @gaelle.c. since you understood the
len(dataset will be easy to understand.
dataset refers to the first row of the dataset. Every item in this row is a column. Therefore to get the total number of columns we’ll use
Is it clear now??
Perfect explanation , I was about to asking the same question too, thank you so much!!