fieldnames_from_csv#

To grab the header lines from all the CSV files and parse to get fieldnames” This code is mostly from GitHub copilot 3/26/2025

Attributes#

Functions#

find_csv_files(directory)

Find all the CSV files in a Path.

main(directory)

Accumulate all the header lines in a directory tree and parse for unique fieldnames.

read_first_line(file_path)

Read the first line of a file.

Module Contents#

fieldnames_from_csv.find_csv_files(directory)#

Find all the CSV files in a Path.

Parameters:

directory (pathlib.Path)

Return type:

list[pathlib.Path]

fieldnames_from_csv.main(directory)#

Accumulate all the header lines in a directory tree and parse for unique fieldnames.

Parameters:

directory (pathlib.Path)

Return type:

None

fieldnames_from_csv.read_first_line(file_path)#

Read the first line of a file.

Parameters:

file_path (pathlib.Path)

Return type:

list[str]

fieldnames_from_csv.directory#