0
こんにちは私は複数の列を反復処理しています。しかし、すべてのCSVファイルの列名は、そのような順序である:複数の列を反復した後に列を順番に取得する
Output: id title content tags
私のコードは、この順序で列を出力ただし:
Output : content id tags title
私はそれを取り戻すにはどうすればよいために、すべてのことCSVファイルはここに
としてそれを持っている以下の私のコードです:
import glob
import os
import pandas as pd
pd.set_option("display.max_rows", 999)
pd.set_option('max_colwidth',100)
import numpy as np
from IPython.display import display
%matplotlib inline
file_path = 'data/'
all_files = glob.glob(os.path.join(file_path, "*.csv"))
merging_csv_files = (pd.read_csv(f) for f in all_files)
stack_exchange_data = pd.concat(merging_csv_files, ignore_index=True)
print ("Data loaded succesfully!")
print ("Stack Exchane Data has {} rows with {} columns each.".format(*stack_exchange_data.shape))
すごく簡単!魅力的に働いた!ありがとう@テッドペトロ –