I want to count row number for certain column with pandas. I have DataFrame like this:
A B C
0 1 a a
1 2 b b
2 3 c c
3 4 NaN NaN
4 5 NaN NaN
5 6 NaN NaN
6 7 NaN NaN
7 8 NaN NaN
8 9 NaN NaN
I want to count number of rows in column B, my code looks like this:
df = pd.read_excel(excel_file_path, sheetname="test", index_col="1")
print(len(df))
print(df)
But regardless of what index_col
i will put it always return the row number of longest column.
What should i change in the code to get the number o rows for column B but without empty rows?