Created
September 12, 2020 06:50
-
-
Save alecbw/fa147f2e19c43063fe9775ca20046cd8 to your computer and use it in GitHub Desktop.
In one command, open a Python shell, get every CSV and XLSX in the local directory, and print its name, row/col count, and column names
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
python3 | |
import pandas as pd; import os; files = [f for f in os.listdir('.') if (os.path.isfile(f) and os.path.getsize(f) != 0 and any(x for x in [".csv", ".xlsx"] if x in f))]; print(files); df_tuples = [(f, pd.read_csv(f)) for f in files]; [print(df_tup[0], df_tup[1].shape, df_tup[1].columns, "\n") for df_tup in df_tuples] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment