Skip to content

Commit

Permalink
add get_headers function
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Troy committed Jun 6, 2024
1 parent 2b0e3c4 commit 9c23e56
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions liiatools/reformat_csv.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,20 @@ def process(input):
with open(file_loc, "w", newline="") as f:
csvwriter = csv.writer(f, delimiter=',')
csvwriter.writerows(new_data)


@reformat_csv.command()
@click.option(
"--input",
"-i",
type=click.Path(exists=True, file_okay=False, readable=True),
)
@click_log.simple_verbosity_option(log)
def get_headers(input):
for root, dirs, files in os.walk(input):
for file in files:
file_loc = f"{root}\\{file}"
if file_loc.endswith(".csv"):
data = pd.read_csv(file_loc)
headers = data.columns.tolist()
print(file_loc, headers)

0 comments on commit 9c23e56

Please sign in to comment.