import numpy as npimport pandas as pddf2 = df2.reset_index(drop=True) # drop=True表示删除原索引,不然会在数据表格中新生成一列'index'数据# 输出df2: a b c d0 16 17 18 191 12 13 14 152 8 9 10 113 4 5 6 74 0 1 2 3
import numpy as np
import pandas as pd
df2 = df2.reset_index(drop=True) # drop=True表示删除原索引,不然会在数据表格中新生成一列'index'数据
# 输出df2:
a b c d
0 16 17 18 19
1 12 13 14 15
2 8 9 10 11
3 4 5 6 7
4 0 1 2 3
索引重置一般用在内容 - df.dropna() - 删除所有包含空值的行