Skip to content

Instantly share code, notes, and snippets.

@loopingleo
Last active September 3, 2018 17:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loopingleo/1cf0c9dfba4a2e4e1c51c3d443d01ff9 to your computer and use it in GitHub Desktop.
Save loopingleo/1cf0c9dfba4a2e4e1c51c3d443d01ff9 to your computer and use it in GitHub Desktop.
import os, glob
import pandas as pd
# read multiple files with SensorLog data
# adjust to your directory - I use iCloud directory on my Mac
path = os.path.expanduser("~/Library/Mobile Documents/com~apple~CloudDocs/SensorLogData")
allFiles = glob.glob(path + "/*.csv")
frame = pd.DataFrame()
list_ = []
# read all files in directory
for file_ in allFiles:
df = pd.read_csv(file_, index_col=None, header=0)
list_.append(df)
# concat all files into one DataFrame
df_sensorData = pd.concat(list_, sort=True)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment