DataFrame

import numpy as npimport pandas as pd def squares(x): return x ** 2 def doubles(x): return x * 2 result1, result2 = squares(3), doubles(3)print(result1, result2)9 6 array = np.array([1, 2, 3])result1 = squares(array) # np.array ** 2result2 = doubles(array) # np.array * 2print(result1, result2)[1 4 9] [2 4 6] df = pd.DataFrame({'a': [1, 2, 3],'b': [4, 5, 6]})print(df)print(squares(df)) a b0 1 41 ..
# gapminder.tsv 파일을 읽어서 데이터 프레임 생성import pandas as pd df = pd.read_csv('gapminder.tsv', sep= '\t', encoding='UTF-8')print(df.iloc[0:5]) country continent year lifeExp pop gdpPercap0 Afghanistan Asia 1952 28.801 8425333 779.4453141 Afghanistan Asia 1957 30.332 9240934 820.8530302 Afghanistan Asia 1962 31.997 10267083 853.1007103 Afghanistan Asia 1967 34.020 11537966 836.1971384 Afghanistan Asia 1..
Codezoy
'DataFrame' 태그의 글 목록