擅长:python、mysql、java
<p>尝试查看<code>glob</code>模块</p>
<pre><code>from glob import glob
import os
path = "./your/path"
files = glob(os.path.join(path, "*.csv"))
dataframes = []
for file in files:
df = pd.read_csv(file)
# rest you would want to append these to dataframes
dataframes.append(df)
</code></pre>
<p>然后,使用<code>pd.concat</code>连接数据帧并执行<code>groupby</code>操作</p>
<p><strong>编辑1:</strong>
根据评论中提到的要求:</p>
<pre><code>results = {}
for file in files:
df = pd.read_csv(file)
# perform operation
df_new = df.groupby('miRNA')['read_count'].sum()
results[file] = df_new
</code></pre>