首页
首页 › 分类 › 正文
⏱ — 分钟读完
我需要删除熊猫中数据框的前三行。
我知道df.ix[:-1]会删除最后一行,但是我不知道如何删除前n行。
df.ix[:-1]
I need to delete the first three rows of a dataframe in pandas.
I know df.ix[:-1] would remove the last row, but I can’t figure out how to remove first n rows.
用途iloc:
iloc
df = df.iloc[3:]
将为您提供一个没有前三行的新df。
Use iloc:
will give you a new df without the first three rows.
🏷️