Level 1 DataFrame 생성하기
2019-09-19
DataFrame 생성 - 1
import pandas as pd
order = [
['2017-01-01', 500, 'confirmed']
['2017-01-03', 700, 'confirmed']
['2017-01-10', 200, 'canceled']
]
order = pd.DataFrame(order)
order
Column 값을 명시할 수 없기때문에 별도로 Column 값 지정 필요
columns = ['data', 'price', 'state']
order = pd.DataFrame(order, columns = columns)
order
DataFrame 생성 - 2
import pandas as pd
order = {
'date': ['2017-01-01', '2017-01-03', '2017-01-10'],
'price': [500, 700, 200],
'state': ['confirmed', 'confirmed', 'canceled']
}
order = pd.DataFrame(order)
order
DataFrame 생성 - 3
import pandas as pd
order = [
{'date': '2017-01-01', 'price': 500, 'state': 'confirmed'},
{'date': '2017-01-03', 'price': 700, 'state': 'confirmed'},
{'date': '2017-01-10', 'price': 200, 'state': 'canceled'},
]
order = pd.DataFrame(order)
order