e.g. idx = '2020-03-20'
n = 20
# n rows before
df.loc[:idx].tail(n)
# n rows after
df.loc[idx:].head(n)
source: Get number of rows before and after a certain index value in pandas
e.g. idx = '2020-03-20'
n = 20
# n rows before
df.loc[:idx].tail(n)
# n rows after
df.loc[idx:].head(n)
source: Get number of rows before and after a certain index value in pandas
885
535
2万+
5万+
1万+

被折叠的 条评论
为什么被折叠?
