Created
August 28, 2020 03:10
-
-
Save lppier/b0df08deba95266a1e638d98224bfdec to your computer and use it in GitHub Desktop.
Cycle through all directories recursively and count all the rows in all the xlsx files
This file contains hidden or 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
| import os | |
| total_qns = 0 | |
| rootdir = '.' | |
| for subdir, dirs, files in os.walk(rootdir): | |
| for file in files: | |
| path = os.path.join(subdir, file) | |
| print(path) | |
| if path.endswith('.xlsx'): | |
| df = pd.read_excel(path) | |
| total_qns += df.shape[0] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment