mirror of
https://github.com/qurator-spk/modstool.git
synced 2025-06-07 19:05:06 +02:00
✨ Optionally output to a CSV file
Resolves gh-9.
This commit is contained in:
parent
840045a54a
commit
0a9a66c2cc
1 changed files with 5 additions and 1 deletions
|
@ -450,7 +450,8 @@ def flatten(d: MutableMapping, parent='', separator='_'):
|
|||
@click.argument('mets_files', type=click.Path(exists=True), required=True, nargs=-1)
|
||||
@click.option('--output', '-o', 'output_file', type=click.Path(), help='Output pickle file',
|
||||
default='mods_info_df.pkl', show_default=True)
|
||||
def process(mets_files: List[str], output_file: str):
|
||||
@click.option('--output-csv', type=click.Path(), help='Output CSV file')
|
||||
def process(mets_files: List[str], output_file: str, output_csv: str):
|
||||
"""
|
||||
A tool to convert the MODS metadata in INPUT to a pandas DataFrame.
|
||||
|
||||
|
@ -517,6 +518,9 @@ def process(mets_files: List[str], output_file: str):
|
|||
# Pickle the DataFrame
|
||||
logging.info('Writing DataFrame to {}'.format(output_file))
|
||||
mods_info_df.to_pickle(output_file)
|
||||
if output_csv:
|
||||
logging.info('Writing CSV to {}'.format(output_csv))
|
||||
mods_info_df.to_csv(output_csv)
|
||||
|
||||
|
||||
def main():
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue