运行 ❯
获得你
自己的Python
服务器
×
更改方向
更改主题,深色/浅色
转到 Spaces
import pandas as pd data = { "name": ["Sally", "Mary", "John"], "age": [50, 40, 30], "qualified": [True, False, False] } idx = ["X", "Y", "Z"] df = pd.DataFrame(data, index=idx) newdf = df.reset_index() print(newdf)
index name age qualified 0 X Sally 50 True 1 Y Mary 40 False 2 Z John 30 False