【发布时间】:2018-03-26 14:06:40
【问题描述】:
我需要将 pandas DataFrame 中的一个对象从一个位置移动到另一个位置,并将该对象的原始位置留空而不影响其他列。
employees = [0, 0, 0, 1, 0, 0, 0, 0, 0, 0]
levels = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
df = pd.DataFrame({"Employees":employees, "Level":levels})
#move employee 1 from index 3 to index 1 without altering Level column
#leave index 3 blank after moving employee 1
视觉上,我需要从starting point 转到end point。
谢谢!
【问题讨论】: