Trương Duy Bằng
New member
How do you count the number of rows in a data frame?
Answer
Use pandas.DataFrame.index to count the number of rows
Answer
Use pandas.DataFrame.index to count the number of rows
- df = pd. DataFrame({“Letters”: [“a”, “b”, “c”], “Numbers”: [1, 2, 3]})
- print(df)
- index = df. index.
- number_of_rows = len(index) find length of index.
- print(number_of_rows)