You can get the row count of a Pandas DataFrame by using the shape
property. The shape
property returns a tuple representing the dimensionality of the DataFrame, where the first element is the number of rows and the second element is the number of columns.
Here's an example:
import pandas as pd df = pd.DataFrame({ "A": [1, 2, 3, 4], "B": ["a", "b", "c", "d"] }) row_count = df.shape[0] print("Row count:", row_count)
Result: Row count: 4
No comments:
Post a Comment