运行 ❯
获取你
自己的 Python
服务器
×
更改方向
更改主题,深色/浅色
进入 Spaces
import pandas as pd data = { "name": ["Sally", "Mary", "John", "Monica"], "age": [50, 40, 30, 40], "qualified": [True, False, False, False] } df = pd.DataFrame(data) newdf = df.set_index('name') print(newdf)
age qualified name Sally 50 True Mary 40 False John 30 False Monica 40 False