我想把第10行,金融科技的值移到下一列,用巴哈马填充同一行的城市列。有什么办法吗?

我发现了熊猫的dataframe.shift()函数,但是它仅限于列,它移动了所有的值。
发布于 2022-03-24 05:25:42
将DataFrame.shift与筛选行和axis=1一起使用
#test None values like Nonetype
m = df['Select Investors'].isna()
#test None values like strings
#m = df['Select Investors'].eq('None')
df.loc[m, 'Country':] = df.loc[m, 'Country':].shift(axis=1)https://stackoverflow.com/questions/71597370
复制相似问题