擅长:python、mysql、java
<p>你试图用数据帧本身的名字,这是行不通的。我假设您试图使用数据帧的名称。您也没有缩短代码中的任何内容,只是将其延长。我建议如下:</p>
<pre><code>df_list = [df1,df2,....,df30]
for i, k in enumerate(df_list):
df_list[i].columns = ['M{}_'.format(i)+col_name.split(".")[-1] for col_name in df_list[i].columns]
</code></pre>