最初に空のdataframeであるdfを作ってそれにひとつ上のフォルダのcsvファイルをconcatで足したいのですが、なぜかファイルが存在しないといわれます。
また、pd.concatの部分でもTypeError: first argument must be an iterable of pandas objects, you passed an object of type "DataFrame"というエラーが出ます。
どこを改善すればよいでしょうか。
-test -test1.csv -test2.csv -python -load_allcsv.py
python
1df = pd.DataFrame(index=[], columns=['date', 'start', 'last', 'id']) 2print(df) 3allfile = os.listdir("../test") 4for csv in allfile: 5 df = pd.concat(df, pd.read_csv(csv, names=('date', 'start', 'last', 'id'))) # CSVファイル読み込み 6print(df)
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。