- ๐๏ธ์ค๋ต๋
ธํธ/-PYTHON
[Python] info()
shoo.
2023. 9. 13. 19:39
info() ํจ์๋ pandas DataFrame์ ๋ํ ์์ฝ ์ ๋ณด๋ฅผ ์ถ๋ ฅํ๋๋ฐ ์ฌ์ฉ๋ฉ๋๋ค. ์ด ํจ์๋ DataFrame์ ํฌ๊ธฐ, ์ปฌ๋ผ ์ด๋ฆ, ๋ฐ์ดํฐ ํ์ , ๋น์ด์์ง ์์ ๊ฐ์ ๊ฐ์ ๋ฑ์ ์ ๊ณตํฉ๋๋ค.
import pandas as pd
# ์ํ ๋ฐ์ดํฐ ์์ฑ
data = {
'Name': ['John', 'Anna', 'Peter', 'Linda'],
'Age': [28, 24, 35, 32],
'City': ['New York', 'Paris', None, 'Berlin']
}
df = pd.DataFrame(data)
# DataFrame ์ ๋ณด ์ถ๋ ฅ
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 4 entries, 0 to 3
Data columns (total 3 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Name 4 non-null object
1 Age 4 non-null int64
2 City 3 non-null object
dtypes: int64(1), object(2)
memory usage: XXX bytes
์ด ๊ฒฐ๊ณผ๋ ์ด ๋ค ๊ฐ์ ํ๊ณผ ์ธ ๊ฐ์ ์ด์ด ์์ผ๋ฉฐ ๊ฐ ์ด์ ๋ฐ์ดํฐ ํ์
๊ณผ ๋น์ด์์ง ์์ ๊ฐ์ ์๋ฅผ ๋ณด์ฌ์ค๋๋ค. City ์ด์์ ํ๋์ ๊ฒฐ์ธก๊ฐ(None)์ ํ์ธํ ์ ์์ต๋๋ค.
๋ฐ๋ผ์ info() ํจ์๋ ์ฃผ๋ก ๋ฐ์ดํฐ ์ ์ฒ๋ฆฌ ๋จ๊ณ์์ DataFrame์ ์ ๋ฐ์ ์ธ ๊ตฌ์กฐ์ ๊ฒฐ์ธก๊ฐ ์ฌ๋ถ ๋ฑ์ ํ์
ํ๋๋ฐ ์ ์ฉํ๊ฒ ์ฌ์ฉ๋ฉ๋๋ค.