Guided Project: Profitable App Profiles for the App Store

Hello,

On page 2/14
https://app.dataquest.io/m/350/guided-project%3A-profitable-app-profiles-for-the-app-store-and-google-play-markets/2/opening-and-exploring-the-data

I don’t understand in the definition of the function explore_data
print(‘Number of rows:’, len(dataset))
print(‘Number of columns:’, len(dataset[0]))

I understand all the results we get and the function itself but I can’t picture len(dataset) and len(dataset[0]) or the logic behind those two arguments in the dataset itself: how does len (dataset) matches to number of rows or len (dataset[0]) to the number of columns.

2 Likes

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[0]) 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[0]) 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

1 Like

Great @gaelle.c. since you understood the len(dataset) now len(dataset[0] will be easy to understand.

dataset[0] 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 len(dataset[0].

Is it clear now??

4 Likes

I think it is, thank you

Perfect explanation , I was about to asking the same question too, thank you so much!!

1 Like