如何从末尾到开头切片数据帧?
how to slice a dataframe from the end to the beginning?
我正在像这样切片数据框:
for i in xrange(0,len(df),100000):
print("slice %d!!!!" % i)
slice= df.iloc[i:(i+100000)]
我现在想获得 100k
个切片 从 df 的末尾到开头 (不必对我的数据帧进行排序)。
我该怎么做?
谢谢!
只需使用tail
:
df.tail(100000)
iloc
的另一个解决方案:
df.iloc[-100000:]
我正在像这样切片数据框:
for i in xrange(0,len(df),100000):
print("slice %d!!!!" % i)
slice= df.iloc[i:(i+100000)]
我现在想获得 100k
个切片 从 df 的末尾到开头 (不必对我的数据帧进行排序)。
我该怎么做?
谢谢!
只需使用tail
:
df.tail(100000)
iloc
的另一个解决方案:
df.iloc[-100000:]