헤맨 만큼 내 땅이다

카테고리 없음

DataFrame 조회하기

mm대장 2023. 10. 27. 10:02

DataFrame 조회하기

  • head(): 데이터프레임의 앞 5행을 보여줌
  • tail(): 데이터프레임의 맨 뒤의 5행을 보여줌
  • info(): 데이터 정보제공(총 데이터 건수, 데이터 타입, 변수의 숫자 등)
  • describe(): 기술통계데이터 제공

lemonade.head()

lemonade.tail()

lemonade.info()

<class 'pandas.core.frame.DataFrame'>
RangeIndex: 32 entries, 0 to 31
Data columns (total 7 columns):
 #   Column       Non-Null Count  Dtype  
---  ------       --------------  -----  
 0   Date         31 non-null     object 
 1   Location     32 non-null     object 
 2   Lemon        32 non-null     int64  
 3   Orange       32 non-null     int64  
 4   Temperature  32 non-null     int64  
 5   Leaflets     31 non-null     float64
 6   Price        32 non-null     float64
dtypes: float64(2), int64(3), object(2)
memory usage: 1.9+ KB

object : 문자열, 날짜 등

int64 : 부호 있는 64비트 정수형

float64 :실수형; 배 정밀도 부동소수점형 (부호 1비트, 지수 11비트, 가수 54비트)

 

lemonade.describe() : #숫자로 이루어진 값에 대해서 다양한 결과값을 보여준다

value_counts()

범주형 데이터의 경우 범주별 데이터 개수 제공 -예) Location을 구성하고 있는 value count

Beach    17
Park     15
Name: Location, dtype: int64