srs_metadata_cleaning.py
def read_csv_with_pandas(filename):

    """
    Function written by Joe Muller, Digital Publishing Coordinator,
    during troubleshooting with Scott St. Louis. November 13, 2020.

    Opens the CSV file into a DataFrame object,
    drops all columns except the ones specified in output_headers,
    and converts the DataFrame to a list of row lists.

    Parameters
    ----------
    filename: str
        The name of the CSV file.

    Returns
    ----------
    list_of_row_lists: list of lists
        Records from metadata CSV file.

    """

    df = pd.read_csv(filename,dtype=str)
    list_of_row_lists = []

    output_headers = [
        "uri",
        "fm:title",
        "marc:245A",
        "marc:245B",
        "marc:250A",
        "ocr:copyrightPage"
    ]

    df = df.reindex(columns = output_headers)

    for i in df.index.values:

        initial_row_as_list = df.iloc[i].to_list()

        row_as_list = []
        for cell in initial_row_as_list:
            if pd.isnull(cell):
                cell = str(cell)
            row_as_list.append(cell)

        list_of_row_lists.append(row_as_list)

    return list_of_row_lists

    Function written by Joe Muller, Digital Publishing Coordinator,
    during troubleshooting with Scott St. Louis. November 13, 2020.

    Opens the CSV file into a DataFrame object,
    drops all columns except the ones specified in output_headers,
    and converts the DataFrame to a list of row lists.

    Parameters
    ----------
    filename: str
        The name of the CSV file.

    Returns
    ----------
    list_of_row_lists: list of lists
        Records from metadata CSV file.

    
Function written by Joe Muller, Digital Publishing Coordinator,
during troubleshooting with Scott St. Louis.

Opens the CSV file into a DataFrame object,
drops all columns except the ones specified in output_headers,
and converts the DataFrame to a list of row lists.
Function written by Joe Muller Digital Publishing Coordinator during troubleshooting with Scott St . Louis . Opens the CSV file into a DataFrame object drops all columns except the ones specified in output_headers and converts the DataFrame to a list of row lists .
def read_csv_with_pandas(filename):
    df = pd.read_csv(filename,dtype=str)
    list_of_row_lists = []
    output_headers = [
        "uri",
        "fm:title",
        "marc:245A",
        "marc:245B",
        "marc:250A",
        "ocr:copyrightPage"
    ]
    df = df.reindex(columns = output_headers)
    for i in df.index.values:
        initial_row_as_list = df.iloc[i].to_list()
        row_as_list = []
        for cell in initial_row_as_list:
            if pd.isnull(cell):
                cell = str(cell)
            row_as_list.append(cell)
        list_of_row_lists.append(row_as_list)
    return list_of_row_lists
def read_csv_with_pandas ( filename ) : df = pd . read_csv ( filename , dtype = str ) list_of_row_lists = [ ] output_headers = [ "uri" , "fm:title" , "marc:245A" , "marc:245B" , "marc:250A" , "ocr:copyrightPage" ] df = df . reindex ( columns = output_headers ) for i in df . index . values : initial_row_as_list = df . iloc [ i ] . to_list ( ) row_as_list = [ ] for cell in initial_row_as_list : if pd . isnull ( cell ) : cell = str ( cell ) row_as_list . append ( cell ) list_of_row_lists . append ( row_as_list ) return list_of_row_lists
Function written by Joe Muller, Digital Publishing Coordinator,
during troubleshooting with Scott St. Louis.
Function written by Joe Muller Digital Publishing Coordinator during troubleshooting with Scott St . Louis .
"""
    Function written by Joe Muller, Digital Publishing Coordinator,
    during troubleshooting with Scott St. Louis. November 13, 2020.

    Opens the CSV file into a DataFrame object,
    drops all columns except the ones specified in output_headers,
    and converts the DataFrame to a list of row lists.

    Parameters
    ----------
    filename: str
        The name of the CSV file.

    Returns
    ----------
    list_of_row_lists: list of lists
        Records from metadata CSV file.

    """
filename
The name of the CSV file.
The name of the CSV file .
Returns

None
----------

None
list_of_row_lists
Records from metadata CSV file.
Records from metadata CSV file .