Post

[Python] df 전체 개수 확인 :: df.size

Reference Pandas In Action

df 데이터 전체 개수 :: df.size

1
2
3
4
5
6
7
import pandas as pd

nba = pd.read_csv(
    './Data/nba.csv',
    parse_dates = ['Birthday']  # 'Birthday'의 데이터 유형을 날짜/시간(datetime)으로 강제 변환
)
nba
 NameTeamPositionBirthdaySalary
0Shake MiltonPhiladelphia 76ersSG1996-09-261445697
1Christian WoodDetroit PistonsPF1995-09-271645357
2PJ WashingtonCharlotte HornetsPF1998-08-233831840
3Derrick RoseDetroit PistonsPG1988-10-047317074
4Marial ShayokPhiladelphia 76ersG1995-07-2679568
445Austin RiversHouston RocketsPG1992-08-012174310
446Harry GilesSacramento KingsPF1998-04-222578800
447Robin LopezMilwaukee BucksC1988-04-014767000
448Collin SextonCleveland CavaliersPG1999-01-044764960
449Ricky RubioPhoenix SunsPG1990-10-2116200000

450 rows × 5 columns

1
df.size
  • DataFrame 객체의 요소의 수를 int형으로 반환
1
nba.size # nba의 총 요소의 수(450 rows * 5 columns)
1
2250
This post is licensed under CC BY 4.0 by the author.