df_name = ['df1','df2','df3','df4','df5','df6','df7','df8','df9','df10']
for name in df_name:
for n in np.arange(0,2000,200):
name = df[df.columns[n:n+200]]
答案 0 :(得分:0)
由于无法使用name = ...
通过字符串分配来动态构建环境对象,因此请考虑使用字典理解来构建数据帧的字典,其中包括zip
以便通过 df_name 逐元素进行迭代和200的倍数:
df_dict = {k:df[df.columns[n:n+199]] \
for k,n in zip(df_name, range(0,2000,200))}
如果存储在元组,列表或字典之类的容器中,则不会丢失数据框的功能:
df_dict['df1'].describe()
df_dict['df2'].head()
df_dict['df3'].tail()
...