12/18/2023 0 Comments Python json csvStill, while the delimiters and quoting characters vary, the overall format is Theseĭifferences can make it annoying to process CSV files from multiple sources. Often exist in the data produced and consumed by different applications. The lack of a well-defined standard means that subtle differences Years prior to attempts to describe the format in a standardized way in I haven't tested this code as I don't have your csv-files but it gives a direction to dig.The so-called CSV (Comma Separated Values) format is the most common import andĮxport format for spreadsheets and databases. Path_2 = r"C:\Users\LordK\Desktop\Daten Krmnicek\Versuch JSON STruktur\MünzenID.csv"ĭf1 = pd.read_csv(path_1, names=FuFelder)ĭf2 = pd.read_csv(path_2, names=MüFelder) Path_json = r"C:\Users\LordK\Desktop\Daten Krmnicek\Versuch JSON STruktur\Skript\out.json" Path_1 = r"C:\Users\LordK\Desktop\Daten Krmnicek\Versuch JSON STruktur\FundorteID.csv" Your task could be accomplished in pandas much faster as it has built-in join function: import pandas as pd Move output.append(Fundrow)įor the future working with csv files I recommend using pandas library. You are updating output before you find necessary itemrow from MünzenReader. Right now i get the findplaces FuFelder displayed, but the nested list Fundrow ist still empty. Json.dump(output, jsonfile,sort_keys=True) MünzenReader = csv.DictReader( Münzen, fieldnames=MüFelder) MüFelder = įundorteReader = csv.DictReader( Fundorte, fieldnames=FuFelder) Münzen = open(r"C:\Users\LordK\Desktop\Daten Krmnicek\Versuch JSON STruktur\MünzenID.csv", 'r')įuFelder = Jsonfile = open(r"C:\Users\LordK\Desktop\Daten Krmnicek\Versuch JSON STruktur\Skript\out.json", 'w') The code used below: Fundorte = open(r"C:\Users\LordK\Desktop\Daten Krmnicek\Versuch JSON STruktur\FundorteID.csv", 'r') I want to create a JSON, so that i can implement geodata in the next step and create a nested GeoJason from this dataset.Īfterwards i wanted to use the Geodata in Leaflet. I wanted to create a nested structure, where every coind of a Findplace is linked inside a nested part of my findplace (Fundorte). I have two tables one containing Information over a findplace of archeological finds with a ID then i have a second table with many coins (80.000) linked with the ID to the findplaces. Problems joining two CSV Tables over ID and exporting as a nested JSON
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |