In [1]:
import pandas as pd
In [2]:
s = pd.Series(["bonggu", 31])
print(s)
Series 생성¶
In [3]:
s = pd.Series(["bong_gu", "chatterBOX"])
s = pd.Series(["bong_gu", "cahtterBOX"], index=["person", "who"])
print(s)
In [4]:
scientists = pd.DataFrame({
'Name': ["Bong_gu", "Yang_o"],
"Job" : ["buyer", "Data_analysis"],
"Born": ["SEOUL", "DONGHAE"],
"Age": [31, 31],
"Hate": ["JaeHyeop","JAeHyeop"]
}, index=["Bong_gu", "Yang_o"], columns=["Name", "Job", "Born", "Hate", "Age"] )
scientists
Out[4]:
In [5]:
## DataFrame에서 순서보장
from collections import OrderedDict
scientists = pd.DataFrame(OrderedDict([
["name", ["Rosaline Franklin", "William Gosset"]],
["Occupation", ["Chemist", "Statistician"]],
["Born", ["1920-07-25", "1876-06-13"]],
["Died", ["1958-04-16", "1937-10-16"]],
["Age", [37, 61]]
]))
print(scientists)
In [6]:
from IPython.core.display import display, HTML
display(HTML("<style> .container{width:100% !important;}</style>"))
'pandas > basic' 카테고리의 다른 글
06.handling_dataframe(bool) (0) | 2018.12.09 |
---|---|
05.handling_series(apply) (0) | 2018.12.09 |
04.handling_series(basic) (0) | 2018.12.09 |
02.basic_statistic (0) | 2018.12.09 |
01.data_slicing (0) | 2018.12.09 |