Projekt

Obecné

Profil

Stáhnout (698 Bajtů) Statistiky
| Větev: | Revize:
1 b3262a44 petrh
PROCESSED_DATA_PATH = "ProcessedData/"
2
3
def get_unique_names_from_file(filename, column_number):
4
    f = open(filename, "r")
5
6
    # create set of unique names
7
    name_set = set()
8
9
    # go through every line of line
10
    for x in f:
11
        # split by csv splitter ;
12
        array = x.split(";")
13
        # add string from chosen column to set
14
        name_set.add(array[column_number])
15
16
    f.close()
17
18
    return name_set
19
20
21
def export_data_to_csv(filename, data_dict):
22
    with open(PROCESSED_DATA_PATH + filename[12:], "w+") as file:
23
24
        for date in data_dict:
25
            for data in data_dict[date]:
26
                file.write(data_dict[date][data].to_csv() + '\n')