Python/Python For Analytics
[Python] pandas dataframe 리스트로 변환
Pydole
2019. 10. 30. 12:48
list 데이터를 pandas dataframe으로 만들기
import pandas as pd
lst_A = ['a','b','c','d', 'e', 1, 2]
df = pd.DataFrame(lst_A)
print(df)
list 타입으로 변환
import numpy as np
np.array(df[0].tolist())
-----------------------------
array(['a', 'b', 'c', 'd', 'e', 'f', 'g'], dtype='<U1')
list(np.array(df[0].tolist()))
------------------------------------
['a', 'b', 'c', 'd', 'e', 'f', 'g']