Advertisement
Guest User

合併轉置

a guest
Dec 5th, 2020
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.29 KB | None | 0 0
  1. import os
  2. import pandas
  3. csv_list = [pandas.read_csv(file, header=None) for file in os.listdir() if file.endswith(".csv")]
  4. if not os.path.exists('Result'):
  5.     os.makedirs('Result')
  6. pandas.concat(csv_list, ignore_index=True, sort=False).T.to_csv('Result/Result.csv', header=False, index=False)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement