xdufacool/collect_local.py
def merge_csv(csv_files):
    """Merge CSV files based on keywords."""
    results = dict()
    data_all = list()
    keys = set()
    for filename in csv_files:
        data, row_len = load_csv_to_dict(filename)
        keys |= set(data.keys())
        data_all.append((data, row_len))
    for key in keys:
        values = list()
        for value, row_len in data_all:
            fill = ["0"]*row_len
            dt = value[key] if key in value else fill
            values.extend(dt)
        results[key] = values
    return results
Merge CSV files based on keywords.
Merge CSV files based on keywords.
Merge CSV files based on keywords .
def merge_csv(csv_files):
    results = dict()
    data_all = list()
    keys = set()
    for filename in csv_files:
        data, row_len = load_csv_to_dict(filename)
        keys |= set(data.keys())
        data_all.append((data, row_len))
    for key in keys:
        values = list()
        for value, row_len in data_all:
            fill = ["0"]*row_len
            dt = value[key] if key in value else fill
            values.extend(dt)
        results[key] = values
    return results
def merge_csv ( csv_files ) : results = dict ( ) data_all = list ( ) keys = set ( ) for filename in csv_files : data , row_len = load_csv_to_dict ( filename ) keys |= set ( data . keys ( ) ) data_all . append ( ( data , row_len ) ) for key in keys : values = list ( ) for value , row_len in data_all : fill = [ "0" ] * row_len dt = value [ key ] if key in value else fill values . extend ( dt ) results [ key ] = values return results
Merge CSV files based on keywords.
Merge CSV files based on keywords .
"""Merge CSV files based on keywords."""
csv_files