Tags:146-1 Count rows in dataframe

How I can access number of rows in pandas Dataframe?

you can view the number of rows by dataframe.shape[0] cmd and to access any particular row you use dataframe.iloc[row_number]

1 Like

the other way is just to do

In the case of Learn data science with Python and R projects, the following was my answer and it was accepted.

What I found weird was that the expected answer in that same tutorial had the values hardcoded. I wonder if they should update it?

concat_axis0 = pd.concat( [head_2015, head_2016] )

question1 = len(concat_axis0.index)

concat_axis1 = pd.concat( [head_2015, head_2016], axis = 1 )
question2 = len(concat_axis1.index)