「TXTを1つずつ読み込んで空のDataframeに結合」を繰り返す [Python][Pandas]
from pathlib import Path
def txt_to_df(str_txt):
# TXTをDataframeに変換する、何らかの処理
return df
txt_path = Path("./txt/")
all_df = pd.DataFrame()
for txt in txt_path.glob("*.txt"):
str_txt = txt.read_text()
df = txt_to_df(str_txt)
all_df = pd.concat([all_df, df])







ディスカッション
コメント一覧
まだ、コメントがありません