Note

Pandas (3) 본문

Pandas

Pandas (3)

Jun's N 2022. 7. 20. 00:40

How to convert the index of a series into a column of a dataframe?

# Input
mylist = list('abcedfghijklmnopqrstuvwxyz')
myarr = np.arange(26)
mydict = dict(zip(mylist, myarr))
ser = pd.Series(mydict)

# Solution
df = ser.to_frame().reset_index()
728x90

'Pandas' 카테고리의 다른 글

Pandas (6)  (0) 2022.07.26
Pandas (5)  (0) 2022.07.25
Pandas (4)  (0) 2022.07.24
Pandas (2)  (0) 2022.07.19
Pandas (1)  (0) 2022.07.18
Comments