property DataFrame.shape

返回一个表示DataFrame维度的元组。

Example

  1. import pandas as pd
  2. df = pd.DataFrame({'site':['google', 'baidu', 'wiki', 'pandas'],
  3. 'age':[18, 39, 22, 45],
  4. 'price': [1.0, 2.0, 3.0, 4.0]})
  5. df.shape
  6. ---------------------------------------------------------
  7. (4, 3)