Skip to content

Instantly share code, notes, and snippets.

@wiccy46
Created July 8, 2019 10:22
Show Gist options
  • Save wiccy46/dbbff1adeb7e8cea4c64eb4d5fc4aeca to your computer and use it in GitHub Desktop.
Save wiccy46/dbbff1adeb7e8cea4c64eb4d5fc4aeca to your computer and use it in GitHub Desktop.
[load_all_csv]Load all CSV files only in a folder. #python #pandas
def get_all_data(fp):
l = os.listdir(fp)
try: l.remove(".DS_Store")
except: pass
for i, fname in enumerate(l):
temp_df = pd.read_csv(fp + fname)
if (i == 0):
r = temp_df
else:
r = r.append(temp_df)
return r
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment