Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 3.x 我需要在数据帧中用另一个单元格替换一个单元格_Python 3.x_Pandas - Fatal编程技术网

Python 3.x 我需要在数据帧中用另一个单元格替换一个单元格

Python 3.x 我需要在数据帧中用另一个单元格替换一个单元格,python-3.x,pandas,Python 3.x,Pandas,我想用pandas数据框中同一行的另一个单元格替换行中的一个单元格这可以解决您的特定问题: df.iloc[4,3] = df.iloc[4,2] df.iloc[4,2] = df.iloc[4,1] 如果你不知道你真正想做什么,就不能说更多了。历史将被“1.”“Verein TechnologietTransfer Handwerk”(Stiftung Adalbert-Seifriz Preis)e.V.“Verein TechnologietTransfer Handwerk”(Sti

我想用pandas数据框中同一行的另一个单元格替换行中的一个单元格

这可以解决您的特定问题:

df.iloc[4,3] = df.iloc[4,2]
df.iloc[4,2] = df.iloc[4,1]

如果你不知道你真正想做什么,就不能说更多了。

历史将被“1.”“Verein TechnologietTransfer Handwerk”(Stiftung Adalbert-Seifriz Preis)e.V.“Verein TechnologietTransfer Handwerk”(Stiftung Adalbert-Seifriz Preis)e.V.“Verein TechnologietTransfer Handwerk”(Stiftung Adalbert-Seifriz Preis)e.V.“将被斯图加特取代,非常感谢。我终于明白了。但是还有一个问题。在我的数据框中,我有不同的城市名称,比如:“Stittgart”,慕尼黑……等等。这个城市的一些地方就像“斯图加特”。我在prep_table1['Sitz']:list_x=x.split('')中使用了这个代码,如果len(list_x)=1:prep_table1['New_Sitz']=list_x[0]elif len(list_x)==2:prep_table1['New Sitz']=list_x[1]其他:prep_table1['New_Sitz']=list_x[2]但它只填充了“三月”。顺便说一下,最后一排是三月一日。我怎样才能解决这个问题。