Python 如何从数据帧设置系列索引,并用其他数据填充系列?

Python 如何从数据帧设置系列索引,并用其他数据填充系列?,python,pandas,Python,Pandas,我有一个pandas dataframemyDataFrame,有许多列和多个索引(两个) 我想创建一个系列,该系列的索引与我的dataframemyDataFrame相同,但在每一行我都设置了一个值 我在想一些大致如下的事情: mySeries.set_index(myDataFrame.index) for i in mySeries.index() mySeries.loc[i] = someValue 多谢各位 你能行 pd.Series(somevalue, inde

我有一个pandas dataframe
myDataFrame
,有许多列和多个索引(两个) 我想创建一个系列,该系列的索引与我的dataframe
myDataFrame
相同,但在每一行我都设置了一个值

我在想一些大致如下的事情:

mySeries.set_index(myDataFrame.index)

for i in mySeries.index()
   mySeries.loc[i] = someValue
  
多谢各位

你能行

 pd.Series(somevalue, index = df.index)