Created
July 8, 2019 10:22
-
-
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
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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