Pandas 通过df.iloc中的可调用函数,每隔n列获取一段excel数据

Pandas 通过df.iloc中的可调用函数,每隔n列获取一段excel数据,pandas,Pandas,下面的代码df_initial=df.iloc[126:236,25:28]#locate first cell为我提供了一个包含109rows*4列的数据帧,我可以对其执行操作 我想通过df.iloc()函数在“for循环”中为每25+4列重复这些操作 首先,我没有得到正确的位置。我的目标是df.iloc[126:236,29:32]。 我的尝试df_initial=df.iloc[126:236,lambda x:x+num:lambda y:y+num1]其中num=25和num1=28产

下面的代码
df_initial=df.iloc[126:236,25:28]#locate first cell
为我提供了一个包含109rows*4列的数据帧,我可以对其执行操作

我想通过df.iloc()函数在“for循环”中为每25+4列重复这些操作

首先,我没有得到正确的位置。我的目标是df.iloc[126:236,29:32]。

我的尝试
df_initial=df.iloc[126:236,lambda x:x+num:lambda y:y+num1]
其中
num=25
num1=28
产生以下错误

无法使用

问题是我不知道如何通过lambda函数传入25+4列