summarize_folder_files

pathsummary.summarize_folder_files(folder_path: Union[str, pathlib.Path]) pandas.core.frame.DataFrame

Summarizes the content of the folder path.

Parameters

folder_path – Path which content is summarized.

Returns

DataFrame

Examples

>>> from pathsummary import summarize_folder_files
>>> from doctestprinter import print_pandas
>>> sample_summary = summarize_folder_files("tests/resources/images")
>>> print_pandas(sample_summary)
                            file_rootpath      filename  encoding
filetype  subtype
   image      bmp  tests/resources/images   image00.bmp      None
              bmp  tests/resources/images   image01.BMP      None
             jpeg  tests/resources/images  image00.jpeg      None
             jpeg  tests/resources/images   image00.jpg      None
             jpeg  tests/resources/images  image01.JPEG      None
             jpeg  tests/resources/images   image01.JPG      None
              png  tests/resources/images   image00.png      None
              png  tests/resources/images   image01.PNG      None
             tiff  tests/resources/images   image00.tif      None
             tiff  tests/resources/images  image00.tiff      None
             tiff  tests/resources/images   image01.TIF      None
             tiff  tests/resources/images  image01.TIFF      None
>>> counts_of_equal_types = sample_summary.index.value_counts()
>>> counts_of_equal_types.sort_index(inplace=True)
>>> print_pandas(counts_of_equal_types, formats="{:<}#{:>}")
('image', 'bmp')   2
('image', 'jpeg')  4
('image', 'png')   2
('image', 'tiff')  4