Data cleaning of csv file with many separated criteria - list
I am struggling in cleaning up and organize the file I attached.
I would need to "clean" the csv file organized in lists and sublists separated by different criteria such as : , comma and {.
I need three columns that show:
-in the first column the number that identify the profession such as "1.1.1.1.0";
-the second column I need the number that identify the characteristic of the profession: there are "attitudini", that has characteristics from "D10a" to "D9b" ; after that there are "competenze" from "C10a" to "C9b"
-the last column should report the value of each characteristic defined in the previous column, for example for the occupation 1.1.1.1.0, attitude D10a is equal to 60.
I give you a subsample example here with just two occupation but I would clean the whole sample with 786 occupations. If necessary I can send you the whole one.
many thanks to whoever can give me some hints.
Best
Roberta
{ "1.1.1.1.0":{ "attitudini":{ "D10a":"60.00000", "D10b":"51.00000", "D11a":"50.00000", "D11b":"39.00000", "D12a":"25.00000", "D12b":"28.00000", "D13a":"45.00000", "D13b":"48.00000", "D14a":"70.00000", "D14b":"71.00000", "D15a":"85.00000", "D15b":"74.00000", "D16a":"50.00000", "D16b":"48.00000", "D17a":"40.00000", "D17b":"40.00000", "D18a":"35.00000", "D18b":"31.00000", "D19a":"40.00000", "D19b":"48.00000", "D1a":"80.00000", "D1b":"82.00000", "D20a":"50.00000", "D20b":"57.00000", "D21a":"90.00000", "D21b":"68.00000", "D22a":"0.00000", "D22b":"0.00000", "D23a":"0.00000", "D23b":"0.00000", "D24a":"0.00000", "D24b":"0.00000", "D25a":"0.00000", "D25b":"0.00000", "D26a":"0.00000", "D26b":"0.00000", "D27a":"0.00000", "D27b":"0.00000", "D28a":"0.00000", "D28b":"0.00000", "D29a":"0.00000", "D29b":"0.00000", "D2a":"75.00000", "D2b":"71.00000", "D30a":"0.00000", "D30b":"0.00000", "D31a":"0.00000", "D31b":"0.00000", "D32a":"0.00000", "D32b":"0.00000", "D33a":"0.00000", "D33b":"0.00000", "D34a":"0.00000", "D34b":"0.00000", "D35a":"0.00000", "D35b":"0.00000", "D36a":"10.00000", "D36b":"8.00000", "D37a":"0.00000", "D37b":"0.00000", "D38a":"0.00000", "D38b":"0.00000", "D39a":"0.00000", "D39b":"0.00000", "D3a":"85.00000", "D3b":"83.00000", "D40a":"0.00000", "D40b":"0.00000", "D41a":"15.00000", "D41b":"14.00000", "D42a":"0.00000", "D42b":"0.00000", "D43a":"0.00000", "D43b":"0.00000", "D44a":"0.00000", "D44b":"0.00000", "D45a":"0.00000", "D45b":"0.00000", "D46a":"0.00000", "D46b":"0.00000", "D47a":"0.00000", "D47b":"0.00000", "D48a":"15.00000", "D48b":"17.00000", "D49a":"10.00000", "D49b":"8.00000", "D4a":"75.00000", "D4b":"77.00000", "D50a":"5.00000", "D50b":"6.00000", "D51a":"45.00000", "D51b":"54.00000", "D52a":"85.00000", "D52b":"94.00000", "D5a":"55.00000", "D5b":"51.00000", "D6a":"70.00000", "D6b":"65.00000", "D7a":"80.00000", "D7b":"85.00000", "D8a":"70.00000", "D8b":"65.00000", "D9a":"60.00000", "D9b":"54.00000", "fk_livello5":"1.1.1.1.0" }, "competenze":{ "C10a":"70.00000", "C10b":"74.00000", "C11a":"90.00000", "C11b":"77.00000", "C12a":"70.00000", "C12b":"74.00000", "C13a":"70.00000", "C13b":"80.00000", "C14a":"75.00000", "C14b":"77.00000", "C15a":"50.00000", "C15b":"45.00000", "C16a":"60.00000", "C16b":"54.00000", "C17a":"80.00000", "C17b":"80.00000", "C18a":"35.00000", "C18b":"37.00000", "C19a":"10.00000", "C19b":"8.00000", "C1a":"90.00000", "C1b":"82.00000", "C20a":"55.00000", "C20b":"54.00000", "C21a":"5.00000", "C21b":"6.00000", "C22a":"0.00000", "C22b":"0.00000", "C23a":"20.00000", "C23b":"20.00000", "C24a":"0.00000", "C24b":"0.00000", "C25a":"0.00000", "C25b":"0.00000", "C26a":"0.00000", "C26b":"0.00000", "C27a":"45.00000", "C27b":"40.00000", "C28a":"0.00000", "C28b":"0.00000", "C29a":"50.00000", "C29b":"68.00000", "C2a":"75.00000", "C2b":"83.00000", "C30a":"35.00000", "C30b":"43.00000", "C31a":"85.00000", "C31b":"83.00000", "C32a":"70.00000", "C32b":"57.00000", "C33a":"45.00000", "C33b":"48.00000", "C34a":"25.00000", "C34b":"28.00000", "C35a":"75.00000", "C35b":"63.00000", "C3a":"80.00000", "C3b":"77.00000", "C4a":"75.00000", "C4b":"85.00000", "C5a":"25.00000", "C5b":"25.00000", "C6a":"35.00000", "C6b":"31.00000", "C7a":"85.00000", "C7b":"85.00000", "C8a":"75.00000", "C8b":"74.00000", "C9a":"45.00000", "C9b":"37.00000", "fk_livello5":"1.1.1.1.0" }, "compiti":{ "p1":"votare normative o trasformare in leggi le proposte di legge", "p10":"leggere i giornali e tenersi aggiornati", "p11":"nominare gli amministratori di aziende partecipate dello stato italiano", "p12":"partecipare a commissioni parlamentari", "p13":"partecipare a convegni, conferenze o congressi", "p14":"trasformare in leggi gli atti del governo", "p2":"svolgere attività istruttoria (interrogazioni, interpellanze, ecc.)", "p3":"tenere i rapporti con il partito di appartenenza", "p4":"partecipare a dibattiti e a trasmissioni radiotelevisive", "p5":"recepire istanze provenienti dal sociale", "p6":"tenere i rapporti con l'elettorato (favorire la partecipazione dei cittadini, divulgare i risultati ottenuti, ecc.)", "p7":"discutere o emendare provvedimenti", "p8":"progettare e avanzare proposte di legge", "p9":"condurre indagini conoscitive su alcuni settori particolari del paese" }, "condizioni_lavoro":{ "H1":"95.00000", "H10":"20.00000", "H11":"55.00000", "H12":"85.00000", "H13":"75.00000", "H14":"25.00000", "H15":"95.00000", "H16":"25.00000", "H17":"50.00000", "H18":"10.00000", "H19":"0.00000", "H2":"80.00000", "H20":"20.00000", "H21":"55.00000", "H22":"20.00000", "H23":"0.00000", "H24":"0.00000", "H25":"0.00000", "H26":"0.00000", "H27":"0.00000", "H28":"0.00000", "H29":"0.00000", "H3":"100.00000", "H30":"0.00000", "H31":"0.00000", "H32":"0.00000", "H33":"0.00000", "H34":"80.00000", "H35":"0.00000", "H36":"25.00000", "H37":"0.00000", "H38":"5.00000", "H39":"35.00000", "H4":"100.00000", "H40":"15.00000", "H41":"5.00000", "H42":"20.00000", "H43":"0.00000", "H44":"0.00000", "H45":"70.00000", "H46":"70.00000", "H47":"90.00000", "H48":"80.00000", "H49":"20.00000", "H5":"95.00000", "H50":"75.00000", "H51":"60.00000", "H52":"70.00000", "H53":"90.00000", "H54":"85.00000", "H55":"0.00000", "H56":"10.00000", "H57":"64.00000", "H6":"90.00000", "H7":"85.00000", "H8":"80.00000", "H9":"75.00000", "fk_livello5":"1.1.1.1.0" }, "conoscenze":{ "B10a":"15.00000", "B10b":"11.00000", "B11a":"0.00000", "B11b":"0.00000", "B12a":"15.00000", "B12b":"11.00000", "B13a":"15.00000", "B13b":"17.00000", "B14a":"30.00000", "B14b":"25.00000", "B15a":"5.00000", "B15b":"3.00000", "B16a":"20.00000", "B16b":"20.00000", "B17a":"20.00000", "B17b":"20.00000", "B18a":"50.00000", "B18b":"48.00000", "B19a":"55.00000", "B19b":"57.00000", "B1a":"45.00000", "B1b":"43.00000", "B20a":"45.00000", "B20b":"54.00000", "B21a":"15.00000", "B21b":"11.00000", "B22a":"0.00000", "B22b":"0.00000", "B23a":"40.00000", "B23b":"45.00000", "B24a":"75.00000", "B24b":"74.00000", "B25a":"55.00000", "B25b":"60.00000", "B26a":"10.00000", "B26b":"11.00000", "B27a":"70.00000", "B27b":"62.00000", "B28a":"60.00000", "B28b":"65.00000", "B29a":"65.00000", "B29b":"57.00000", "B2a":"50.00000", "B2b":"57.00000", "B30a":"95.00000", "B30b":"86.00000", "B31a":"30.00000", "B31b":"28.00000", "B32a":"80.00000", "B32b":"74.00000", "B33a":"40.00000", "B33b":"34.00000", "B3a":"70.00000", "B3b":"62.00000", "B4a":"10.00000", "B4b":"11.00000", "B5a":"85.00000", "B5b":"77.00000", "B6a":"55.00000", "B6b":"48.00000", "B7a":"30.00000", "B7b":"34.00000", "B8a":"10.00000", "B8b":"11.00000", "B9a":"25.00000", "B9b":"25.00000", "fk_livello5":"1.1.1.1.0" }, "gwa":{ "G10a":"90.00000", "G10b":"91.00000", "G11a":"65.00000", "G11b":"68.00000", "G12a":"90.00000", "G12b":"88.00000", "G13a":"70.00000", "G13b":"71.00000", "G14a":"80.00000", "G14b":"71.00000", "G15a":"95.00000", "G15b":"82.00000", "G16a":"5.00000", "G16b":"3.00000", "G17a":"0.00000", "G17b":"0.00000", "G18a":"0.00000", "G18b":"0.00000", "G19a":"55.00000", "G19b":"42.00000", "G1a":"85.00000", "G1b":"88.00000", "G20a":"0.00000", "G20b":"0.00000", "G21a":"0.00000", "G21b":"0.00000", "G22a":"0.00000", "G22b":"0.00000", "G23a":"0.00000", "G23b":"0.00000", "G24a":"60.00000", "G24b":"57.00000", "G25a":"50.00000", "G25b":"51.00000", "G26a":"85.00000", "G26b":"82.00000", "G27a":"75.00000", "G27b":"79.00000", "G28a":"85.00000", "G28b":"85.00000", "G29a":"45.00000", "G29b":"37.00000", "G2a":"60.00000", "G2b":"51.00000", "G30a":"50.00000", "G30b":"45.00000", "G31a":"60.00000", "G31b":"71.00000", "G32a":"75.00000", "G32b":"79.00000", "G33a":"65.00000", "G33b":"60.00000", "G34a":"70.00000", "G34b":"60.00000", "G35a":"55.00000", "G35b":"54.00000", "G36a":"70.00000", "G36b":"54.00000", "G37a":"75.00000", "G37b":"68.00000", "G38a":"45.00000", "G38b":"43.00000", "G39a":"25.00000", "G39b":"28.00000", "G3a":"40.00000", "G3b":"40.00000", "G40a":"30.00000", "G40b":"28.00000", "G41a":"30.00000", "G41b":"28.00000", "G4a":"15.00000", "G4b":"14.00000", "G5a":"45.00000", "G5b":"40.00000", "G6a":"50.00000", "G6b":"48.00000", "G7a":"50.00000", "G7b":"51.00000", "G8a":"55.00000", "G8b":"65.00000", "G9a":"45.00000", "G9b":"48.00000", "fk_livello5":"1.1.1.1.0" }, "stili_lavoro":{ "F1":"75.00000", "F10":"70.00000", "F11":"95.00000", "F12":"80.00000", "F13":"100.00000", "F14":"75.00000", "F15":"80.00000", "F16":"90.00000", "F2":"85.00000", "F3":"90.00000", "F4":"80.00000", "F5":"70.00000", "F6":"80.00000", "F7":"60.00000", "F8":"80.00000", "F9":"85.00000", "fk_livello5":"1.1.1.1.0" }, "valori_professione":{ "E1":"60.00000", "E10":"40.00000", "E11":"70.00000", "E12":"40.00000", "E13":"0.00000", "E14":"90.00000", "E15":"60.00000", "E16":"50.00000", "E17":"40.00000", "E18":"20.00000", "E19":"70.00000", "E2":"60.00000", "E20":"20.00000", "E21":"50.00000", "E3":"80.00000", "E4":"30.00000", "E5":"50.00000", "E6":"90.00000", "E7":"10.00000", "E8":"30.00000", "E9":"50.00000", "fk_livello5":"1.1.1.1.0" } }, "1.1.1.2.0":{ "attitudini":{ "D10a":"58.00000", "D10b":"50.00000", "D11a":"49.00000", "D11b":"49.00000", "D12a":"22.00000", "D12b":"25.00000", "D13a":"29.00000", "D13b":"34.00000", "D14a":"63.00000", "D14b":"58.00000", "D15a":"72.00000", "D15b":"68.00000", "D16a":"50.00000", "D16b":"50.00000", "D17a":"33.00000", "D17b":"37.00000", "D18a":"14.00000", "D18b":"14.00000", "D19a":"18.00000", "D19b":"20.00000", "D1a":"87.00000", "D1b":"78.00000", "D20a":"62.00000", "D20b":"57.00000", "D21a":"79.00000", "D21b":"71.00000", "D22a":"1.00000", "D22b":"1.00000", "D23a":"0.00000", "D23b":"0.00000", "D24a":"1.00000", "D24b":"1.00000", "D25a":"0.00000", "D25b":"0.00000", "D26a":"0.00000", "D26b":"0.00000", "D27a":"0.00000", "D27b":"0.00000", "D28a":"0.00000", "D28b":"0.00000", "D29a":"0.00000", "D29b":"0.00000", "D2a":"92.00000", "D2b":"79.00000", "D30a":"0.00000", "D30b":"0.00000", "D31a":"0.00000", "D31b":"0.00000", "D32a":"0.00000", "D32b":"0.00000", "D33a":"0.00000", "D33b":"0.00000", "D34a":"0.00000", "D34b":"0.00000", "D35a":"0.00000", "D35b":"0.00000", "D36a":"3.00000", "D36b":"1.00000", "D37a":"0.00000", "D37b":"0.00000", "D38a":"0.00000", "D38b":"0.00000", "D39a":"0.00000", "D39b":"0.00000", "D3a":"89.00000", "D3b":"82.00000", "D40a":"0.00000", "D40b":"0.00000", "D41a":"11.00000", "D41b":"13.00000", "D42a":"7.00000", "D42b":"11.00000", "D43a":"4.00000", "D43b":"4.00000", "D44a":"4.00000", "D44b":"4.00000", "D45a":"4.00000", "D45b":"4.00000", "D46a":"1.00000", "D46b":"1.00000", "D47a":"1.00000", "D47b":"1.00000", "D48a":"7.00000", "D48b":"4.00000", "D49a":"8.00000", "D49b":"7.00000", "D4a":"83.00000", "D4b":"78.00000", "D50a":"12.00000", "D50b":"10.00000", "D51a":"22.00000", "D51b":"23.00000", "D52a":"71.00000", "D52b":"65.00000", "D5a":"64.00000", "D5b":"67.00000", "D6a":"57.00000", "D6b":"57.00000", "D7a":"75.00000", "D7b":"73.00000", "D8a":"80.00000", "D8b":"74.00000", "D9a":"79.00000", "D9b":"73.00000", "fk_livello5":"1.1.1.2.0" }, "competenze":{ "C10a":"70.00000", "C10b":"68.00000", "C11a":"67.00000", "C11b":"66.00000", "C12a":"72.00000", "C12b":"75.00000", "C13a":"75.00000", "C13b":"76.00000", "C14a":"83.00000", "C14b":"79.00000", "C15a":"53.00000", "C15b":"50.00000", "C16a":"70.00000", "C16b":"66.00000", "C17a":"80.00000", "C17b":"76.00000", "C18a":"66.00000", "C18b":"64.00000", "C19a":"5.00000", "C19b":"7.00000", "C1a":"97.00000", "C1b":"84.00000", "C20a":"32.00000", "C20b":"35.00000", "C21a":"3.00000", "C21b":"3.00000", "C22a":"0.00000", "C22b":"0.00000", "C23a":"29.00000", "C23b":"24.00000", "C24a":"0.00000", "C24b":"0.00000", "C25a":"0.00000", "C25b":"0.00000", "C26a":"0.00000", "C26b":"0.00000", "C27a":"58.00000", "C27b":"57.00000", "C28a":"0.00000", "C28b":"0.00000", "C29a":"53.00000", "C29b":"57.00000", "C2a":"92.00000", "C2b":"84.00000", "C30a":"55.00000", "C30b":"55.00000", "C31a":"79.00000", "C31b":"78.00000", "C32a":"79.00000", "C32b":"72.00000", "C33a":"75.00000", "C33b":"66.00000", "C34a":"36.00000", "C34b":"34.00000", "C35a":"72.00000", "C35b":"70.00000", "C3a":"84.00000", "C3b":"79.00000", "C4a":"92.00000", "C4b":"85.00000", "C5a":"26.00000", "C5b":"30.00000", "C6a":"13.00000", "C6b":"15.00000", "C7a":"83.00000", "C7b":"79.00000", "C8a":"79.00000", "C8b":"72.00000", "C9a":"43.00000", "C9b":"41.00000", "fk_livello5":"1.1.1.2.0" }, "compiti":{ "p1":"progettare e avanzare proposte di legge", "p10":"curare i rapporti con le istituzioni", "p11":"curare i rapporti con rappresentanti politici, sindacali, economici e sociali", "p12":"emettere ordinanze o delibere", "p13":"organizzare o partecipare a eventi (convegni, comizi, congressi, manifestazioni, ecc.)", "p14":"organizzare/partecipare a riunioni", "p15":"recepire istanze provenienti dal territorio", "p16":"curare i rapporti con soggetti o enti esterni", "p17":"discutere o emendare provvedimenti", "p18":"formulare pareri o proposte", "p19":"gestire le risorse finanziarie", "p2":"prendere parte alle sedute del consiglio o della giunta", "p20":"tenere i rapporti con il partito di appartenenza", "p21":"tenere i rapporti con l'elettorato (favorire la partecipazione dei cittadini, divulgare i risultati ottenuti, ecc.)", "p22":"aggiornarsi sulla normativa vigente", "p23":"curare i rapporti con i mezzi di informazione", "p24":"gestire e/o coordinare le risorse umane", "p25":"istruire procedimenti amministrativi", "p26":"rappresentare il consiglio o la giunta regionale", "p27":"svolgere attività istruttoria (interrogazioni, interpellanze, ecc.)", "p28":"cercare e reperire finanziamenti", "p29":"collaborare con le autorità politiche", "p3":"partecipare alle sedute delle commissioni", "p30":"curare i rapporti con i rappresentanti di altri partiti", "p31":"esercitare vigilanza amministrativa su enti controllati dalla regione", "p32":"verificare i risultati", "p4":"organizzare il lavoro o le attività", "p5":"votare normative o trasformare in leggi le proposte di legge", "p6":"applicare norme o regolamenti", "p7":"far parte di organi istituzionali", "p8":"impostare, sviluppare o controllare la realizzazione dei progetti", "p9":"svolgere attività di controllo sull'azione degli organismi di governo" }, "condizioni_lavoro":{ "H1":"96.05263", "H10":"30.26316", "H11":"64.47368", "H12":"68.42105", "H13":"48.68421", "H14":"2.63158", "H15":"94.73684", "H16":"11.84211", "H17":"21.05263", "H18":"1.31579", "H19":"0.00000", "H2":"65.78947", "H20":"32.89474", "H21":"31.57895", "H22":"18.42105", "H23":"7.89474", "H24":"0.00000", "H25":"0.00000", "H26":"0.00000", "H27":"0.00000", "H28":"0.00000", "H29":"0.00000", "H3":"100.00000", "H30":"0.00000", "H31":"0.00000", "H32":"0.00000", "H33":"0.00000", "H34":"71.05263", "H35":"0.00000", "H36":"23.68421", "H37":"0.00000", "H38":"0.00000", "H39":"30.26316", "H4":"100.00000", "H40":"2.63158", "H41":"0.00000", "H42":"5.26316", "H43":"0.00000", "H44":"0.00000", "H45":"56.57895", "H46":"80.26316", "H47":"67.10526", "H48":"75.00000", "H49":"6.57895", "H5":"93.42105", "H50":"64.47368", "H51":"21.05263", "H52":"68.42105", "H53":"75.00000", "H54":"65.78947", "H55":"3.94737", "H56":"5.26316", "H57":"55.15789", "H6":"92.10526", "H7":"81.57895", "H8":"69.73684", "H9":"75.00000", "fk_livello5":"1.1.1.2.0" }, "conoscenze":{ "B10a":"13.00000", "B10b":"15.00000", "B11a":"3.00000", "B11b":"8.00000", "B12a":"8.00000", "B12b":"6.00000", "B13a":"3.00000", "B13b":"4.00000", "B14a":"29.00000", "B14b":"35.00000", "B15a":"7.00000", "B15b":"11.00000", "B16a":"5.00000", "B16b":"5.00000", "B17a":"5.00000", "B17b":"6.00000", "B18a":"51.00000", "B18b":"53.00000", "B19a":"43.00000", "B19b":"42.00000", "B1a":"57.00000", "B1b":"50.00000", "B20a":"22.00000", "B20b":"24.00000", "B21a":"1.00000", "B21b":"2.00000", "B22a":"11.00000", "B22b":"8.00000", "B23a":"39.00000", "B23b":"42.00000", "B24a":"87.00000", "B24b":"77.00000", "B25a":"54.00000", "B25b":"53.00000", "B26a":"7.00000", "B26b":"8.00000", "B27a":"26.00000", "B27b":"30.00000", "B28a":"26.00000", "B28b":"28.00000", "B29a":"45.00000", "B29b":"44.00000", "B2a":"37.00000", "B2b":"35.00000", "B30a":"87.00000", "B30b":"82.00000", "B31a":"30.00000", "B31b":"23.00000", "B32a":"61.00000", "B32b":"55.00000", "B33a":"25.00000", "B33b":"28.00000", "B3a":"43.00000", "B3b":"43.00000", "B4a":"24.00000", "B4b":"25.00000", "B5a":"61.00000", "B5b":"61.00000", "B6a":"55.00000", "B6b":"52.00000", "B7a":"22.00000", "B7b":"24.00000", "B8a":"11.00000", "B8b":"11.00000", "B9a":"28.00000", "B9b":"28.00000", "fk_livello5":"1.1.1.2.0" }, "gwa":{ "G10a":"82.00000", "G10b":"75.00000", "G11a":"62.00000", "G11b":"60.00000", "G12a":"74.00000", "G12b":"69.00000", "G13a":"79.00000", "G13b":"70.00000", "G14a":"64.00000", "G14b":"65.00000", "G15a":"75.00000", "G15b":"69.00000", "G16a":"0.00000", "G16b":"0.00000", "G17a":"0.00000", "G17b":"0.00000", "G18a":"0.00000", "G18b":"0.00000", "G19a":"39.00000", "G19b":"33.00000", "G1a":"74.00000", "G1b":"70.00000", "G20a":"5.00000", "G20b":"1.00000", "G21a":"5.00000", "G21b":"5.00000", "G22a":"0.00000", "G22b":"0.00000", "G23a":"0.00000", "G23b":"0.00000", "G24a":"32.00000", "G24b":"36.00000", "G25a":"66.00000", "G25b":"58.00000", "G26a":"80.00000", "G26b":"76.00000", "G27a":"88.00000", "G27b":"85.00000", "G28a":"91.00000", "G28b":"80.00000", "G29a":"36.00000", "G29b":"33.00000", "G2a":"50.00000", "G2b":"47.00000", "G30a":"14.00000", "G30b":"18.00000", "G31a":"70.00000", "G31b":"71.00000", "G32a":"47.00000", "G32b":"46.00000", "G33a":"71.00000", "G33b":"70.00000", "G34a":"64.00000", "G34b":"59.00000", "G35a":"33.00000", "G35b":"36.00000", "G36a":"68.00000", "G36b":"70.00000", "G37a":"50.00000", "G37b":"49.00000", "G38a":"55.00000", "G38b":"55.00000", "G39a":"26.00000", "G39b":"25.00000", "G3a":"25.00000", "G3b":"24.00000", "G40a":"33.00000", "G40b":"35.00000", "G41a":"67.00000", "G41b":"69.00000", "G4a":"11.00000", "G4b":"10.00000", "G5a":"26.00000", "G5b":"29.00000", "G6a":"46.00000", "G6b":"46.00000", "G7a":"55.00000", "G7b":"52.00000", "G8a":"38.00000", "G8b":"38.00000", "G9a":"61.00000", "G9b":"54.00000", "fk_livello5":"1.1.1.2.0" }, "stili_lavoro":{ "F1":"80.00000", "F10":"82.00000", "F11":"91.00000", "F12":"74.00000", "F13":"93.00000", "F14":"76.00000", "F15":"72.00000", "F16":"82.00000", "F2":"84.00000", "F3":"80.00000", "F4":"82.00000", "F5":"86.00000", "F6":"84.00000", "F7":"86.00000", "F8":"83.00000", "F9":"86.00000", "fk_livello5":"1.1.1.2.0" }, "valori_professione":{ "E1":"61.00000", "E10":"21.00000", "E11":"61.00000", "E12":"50.00000", "E13":"45.00000", "E14":"66.00000", "E15":"61.00000", "E16":"32.00000", "E17":"26.00000", "E18":"8.00000", "E19":"50.00000", "E2":"47.00000", "E20":"37.00000", "E21":"55.00000", "E3":"74.00000", "E4":"13.00000", "E5":"63.00000", "E6":"58.00000", "E7":"18.00000", "E8":"37.00000", "E9":"39.00000", "fk_livello5":"1.1.1.2.0" } }
The way I would tackle a job like this, is with the wonderful Find/Replace feature in any run-of-the-mill text editor. (Ctrl+H is usually the hotkey/shortcut)
Start by trimming the fat,
replace all " with nothing.
replace all .0000 with nothing.
The challenging bit is to get the first column inserted before every 2nd/3rd column value.
The quickest way would be to replace all , with ,1.1.1.1.0,. But this would be putting the first column as the third. Simply cut the last one and put it to the beginning to correct that.
The issue with this approach is that you have more than just 1.1.1.1.0 as a first column value. If there aren't too many different values, I would tackle each "block" separately. Just cut the block out and do the previous find/replace in a blank document, repeat for each block.
Yes there is a little bit of manual work here with chopping and changing, but that's usually how it goes with data cleanup!
Finally, replace all : with , (for the 2nd/3rd column separation)
This is a JSON, not a csv.
JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate.
You can paste the content here to read it.
(Notice that you lost a } at the end of the content posted in question.)
Send the file to ningshen_zhang#163.com. Let me help you to convert.
Or you may do it yourself. Here is the code in C#:
using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json;
namespace SharpTest
{
class Program
{
static void Main(string[] args)
{
string filePath = "XXX/content.json";
string savePath = "XXX/output.csv";
string json = File.ReadAllText(filePath);
var re = JsonConvert.DeserializeObject<Dictionary<string, Dictionary<string, Dictionary<string, string>>>>(json);
using(StreamWriter writer = new StreamWriter(savePath))
{
foreach(var pair1 in re)
{
foreach(var pair2 in pair1.Value)
{
foreach(var pair3 in pair2.Value)
{
if(pair3.Key.StartsWith("fk_")) continue;
writer.WriteLine(pair1.Key + "," + pair3.Key + ",\"" + pair3.Value + '"');
}
}
}
}
}
}
}
Related
How to capture the event whenever the items inside a listview are checked
I'm developing a plugin in QGIS 2.8.2 using Pyqt 4. Well the idea is using the processing 'qgis:extractbylocation' from the QGIS algorithm provider to capture the studied area . # Récupérer tous les iris qui s'intersectent avec la zone d'étude res = processing.runalg('qgis:extractbylocation', irisLayer, layerZone, u'intersects', 0, None) # Créer une couche vector issue de l'extraction des IRIS dans la zone ObjectifVilleExtract.irisLayer = QgsVectorLayer(res['OUTPUT'], "IRIS dans la zone d'etude", "ogr") QgsMapLayerRegistry.instance().addMapLayer(ObjectifVilleExtract.irisLayer) # Définir un ecodage Windows compatible avec le français ObjectifVilleExtract.irisLayer.setProviderEncoding(u'iso-8859-1') # Modifier l'encoage ObjectifVilleExtract.irisLayer.dataProvider().setEncoding(u'iso-8859-1') # Vérifier que le couche est valide sinon afficher que la couche est erronée if not ObjectifVilleExtract.irisLayer.isValid(): print "Layer failed to load!" Then showing the results on a listview: ObjectifVilleExtract.features = ObjectifVilleExtract.irisLayer.getFeatures() ObjectifVilleExtract.model = QStandardItemModel(ObjectifVilleExtract.features) for feature in ObjectifVilleExtract.features: item = QStandardItem(feature['nom_iris']) item.setCheckable(True) ObjectifVilleExtract.model.appendRow(item) self.dlg.listView_3.setModel(ObjectifVilleExtract.model) self.dlg.listView_3.show() Now I want to capture checked item on the listview, to apply on its the following processes : iter = ObjectifVilleExtract.features.getFeatures() for feature in iter : q1 = "SELECT nom_com FROM france_full_data.contours_iris WHERE code_iris='" + feature['code_iris'] + "' " I tried to use the following code : for feature in ObjectifVilleExtract.features: while ObjectifVilleExtract.model.item(feature['nom_iris']) : if ObjectifVilleExtract.model.item(feature['nom_iris']).ischecked(): ObjectifVilleExtract.iter = ObjectifVilleExtract.irisLayer.getFeatures() irisTab=[] for feature in ObjectifVilleExtract.iter : q1 = "SELECT nom_com FROM france_full_data.contours_iris WHERE code_iris='" + feature['code_iris'] + "' " the result is empty !
flask_restplus' marshal_with returns response with null values
I am using flask_restplus to create a documented API. The marshal decorator controls what data actually gets rendered in your response, but I am having trouble rendering the data. I have the following code: kpis_model = api.model('kpis', { 'cpl_actual': fields.Integer(description='costo por lead total del mes actual'), 'cpl_anterior': fields.Integer(description='costo por lead total del mes anterior'), 'cpl_diferencia': fields.Integer(description='diferencia de cpl_actual y cpl_anterior') }) #data.route('/kpis/<cliente>/<mes>/<ano>') #data.doc(params={'cliente': 'id de Facebook del cliente','mes':'el mes que se desea usar (dos digitos)','ano':'el ano que se desea usar (cuatro digitos)'}) class Kpis(Resource): #data.marshal_with(kpis_model) def get(self,cliente,mes,ano): '''sacar KPIs principales''' data = {} data['cpl_actual'] = 300 data['cpl_anterior'] = 100 data['cpl_diferencia'] = data['cpl_actual'] - data['cpl_anterior'] return jsonify(data) And then when I go to the route /kpis/cliente/mes/ano it returns this: { "cpl_diferencia": null, "cpl_anterior": null, "cpl_actual": null } Why are the values being returned as null ? can someone help me please!
You don't need to jsonify when using "marshal_with" Just return "data" return data =)
Original route doesn't work
I have this code, but when i run the program the first cin doesn't work I don't understand the reason /*Metodo che calcola in byte la differenza tra il file non compresso e quello compresso aprendo i due files, calcolando la lunghezza e facendo la differenza*/ void Huffman::rate_compression(){ cout<<"Inserisci il percorso del file originale:\t"<<endl; string route; cin>>route; ifstream filenoncompresso; filenoncompresso.open("route",ifstream::in); filenoncompresso.seekg(0,filenoncompresso.end); int lenght1=filenoncompresso.tellg(); filenoncompresso.seekg(0,filenoncompresso.beg); filenoncompresso.close(); ifstream filecompresso; string way; route.erase(route.end()-4,route.end()); way=route+".aa"; filecompresso.open("way",ifstream::in); filecompresso.seekg(0,filecompresso.end); int lenght2=filecompresso.tellg(); lenght2-=1028; filecompresso.seekg(0,filecompresso.beg); cout<<"La differenza in byte tra il file non compresso e il file compresso e': "<<lenght1-lenght2<<endl; }
Retain latin accent characters C++ ISO-8859-1
A C++ program sends the following as an email subject with the following text: Adjuntamos información existente en nuestra base de datos. Si el informe llegase en blanco, quiere decir que no ha tenido ninguna incidencia en el periodo indicado o no figura información. Si desea responder a este correo, por favor, hágalo a The encoding is set to ISO-8859-1. The text is getting sent to the email recipient as: Adjuntamos información existente en nuestra base de datos. Si el informe llegase en blanco, quiere decir que no ha tenido ninguna incidencia en el periodo indicado o no figura información. Si desea responder a este correo, por favor, hágalo a What do I need set my encoding to have the accent characters remain as inputed?
CPJNSMTPBodyPart::CPJNSMTPBodyPart() : m_sCharset(_T("UTF-8")), m_sContentType(_T("text/plain")), m_pParentBodyPart(NULL), m_bAttachment(FALSE), m_pszRawBody(NULL), m_ContentTransferEncoding(NO_ENCODING) { //Automatically generate a unique boundary separator for this body part by creating a guid m_sBoundary = CreateGUID(); }
getting <null> when trying to parse JSON response
i have problem with getting <null> when trying to display a string on a UILabel or either on the console, here is my code step by step : NSArray *array=[[request responseString]JSONValue]; for (int i=0; i<[array count]; i++) { NSDictionary *stationEnCours=[array objectAtIndex:i]; NSLog(#"%#",[stationEnCours objectForKey:#"ssiphone_adresse"]); } topStation.sstationAdress=[stationEnCours objectForKey:#"ssiphone_adresse"]; //global variable adresseStation.text=[NSString stringWithFormat:#"%#",topStation.sstationAdress];//display on label Now for both the console and the label i got <null> although i have check it in my data base it's not null. is that due to JSON parsing rules ? how can i fix it ? thx in advance for help :) EDIT : here is my response string : 2011-05-12 15:09:38.424 TopStation[1070:207] response string :[ {"ssiphone_idstation":"80","0":"80","ssiphone_etatstation":"true","1":"true","ssiphone_commerce":"true","2":"true","ssiphone_stationdelavage":"false","3":"false","ssiphone_typescarburants":"Sans Plomb 95,SP95-E10,Gazole,GPLc,GNV,","4":"Sans Plomb 95,SP95-E10,Gazole,GPLc,GNV,","ssiphone_joursdelasemaine":"7J\/7","5":"7J\/7","ssiphone_horaires":"24h\/24","6":"24h\/24","ssiphone_telephone":"0400221997","7":"0400221997","ssiphone_sensdecirculation":"(Sens >> Aix-en-Prov.\/Marseille)","8":"(Sens >> Aix-en-Prov.\/Marseille)","ssiphone_adresse":"A 51 - Aire de la Champouse","9":"A 51 - Aire de la Champouse","ssiphone_ville":"BOUC-BEL-AIR","10":"BOUC-BEL-AIR","ssiphone_departement":"13","11":"13","ssiphone_longitude":"5.39532","12":"5.39532","ssiphone_latitude":"43.4416","13":"43.4416","ssiphone_nomstation":"RELAIS TOTAL DE LA CHAMPOUSE","14":"RELAIS TOTAL DE LA CHAMPOUSE","ssiphone_voie":"A 51","15":"A 51","ssiphone_enseigne":"TOTAL","16":"TOTAL","ssiphone_codepostal":"13320","17":"13320","ssiphone_referencegps":"TOTAL DE LA CHAMPOUSE A 51","18":"TOTAL DE LA CHAMPOUSE A 51","distance":17.3}, {"ssiphone_idstation":"86","0":"86","ssiphone_etatstation":"true","1":"true","ssiphone_commerce":"true","2":"true","ssiphone_stationdelavage":"false","3":"false","ssiphone_typescarburants":"SP95-E10,Gazole,Super Gazole,GPLc,GNV,","4":"SP95-E10,Gazole,Super Gazole,GPLc,GNV,","ssiphone_joursdelasemaine":"7J\/7","5":"7J\/7","ssiphone_horaires":"24h\/24","6":"24h\/24","ssiphone_telephone":"0442591667","7":"0442591667","ssiphone_sensdecirculation":"","8":"","ssiphone_adresse":null,"9":null,"ssiphone_ville":"AIX-EN-PROVENCE","10":"AIX-EN-PROVENCE","ssiphone_departement":"13","11":"13","ssiphone_longitude":"5.43361","12":"5.43361","ssiphone_latitude":"43.5194","13":"43.5194","ssiphone_nomstation":"STATION BP","14":"STATION BP","ssiphone_voie":"","15":"","ssiphone_enseigne":"BP","16":"BP","ssiphone_codepostal":"13100","17":"13100","ssiphone_referencegps":"BP AIX EN PROVENCE","18":"BP AIX EN PROVENCE","distance":25.3},{"ssiphone_idstation":"89","0":"89","ssiphone_etatstation":"true","1":"true","ssiphone_commerce":"true","2":"true","ssiphone_stationdelavage":"false","3":"false","ssiphone_typescarburants":"SP95-E10,E85,Gazole,Super Gazole,GPLc,","4":"SP95-E10,E85,Gazole,Super Gazole,GPLc,","ssiphone_joursdelasemaine":"7J\/7","5":"7J\/7","ssiphone_horaires":null,"6":null,"ssiphone_telephone":"0442264052","7":"0442264052","ssiphone_sensdecirculation":"(Centre ville) (A8 sortie 31)","8":"(Centre ville) (A8 sortie 31)","ssiphone_adresse":"467 Avenue Henri Mauriat","9":"467 Avenue Henri Mauriat","ssiphone_ville":"AIX-EN-PROVENCE","10":"AIX-EN-PROVENCE","ssiphone_departement":"13","11":"13","ssiphone_longitude":"5.4661","12":"5.4661","ssiphone_latitude":"43.5157","13":"43.5157","ssiphone_nomstation":null,"14":null,"ssiphone_voie":"","15":"","ssiphone_enseigne":"TOTAL","16":"TOTAL","ssiphone_codepostal":"13090","17":"13090","ssiphone_referencegps":"TOTAL DE L'ARC","18":"TOTAL DE L'ARC","distance":24.9},{"ssiphone_idstation":"91","0":"91","ssiphone_etatstation":"true","1":"true","ssiphone_commerce":"true","2":"true","ssiphone_stationdelavage":"false","3":"false","ssiphone_typescarburants":"Sans Plomb 95,Sans Plomb 98,Gazole,Super Gazole,GPLc,GNV,","4":"Sans Plomb 95,Sans Plomb 98,Gazole,Super Gazole,GPLc,GNV,","ssiphone_joursdelasemaine":"7J\/7","5":"7J\/7","ssiphone_horaires":"L-S: 7h30-20h","6":"L-S: 7h30-20h","ssiphone_telephone":"0442958459","7":"0442958459","ssiphone_sensdecirculation":"(Dir.>> Aix Ouest) ","8":"(Dir.>> Aix Ouest) ","ssiphone_adresse":"Route de Berre - Jas de Bouffan","9":"Route de Berre - Jas de Bouffan","ssiphone_ville":"AIX-EN-PROVENCE","10":"AIX-EN-PROVENCE","ssiphone_departement":"13","11":"13","ssiphone_longitude":"5.41778","12":"5.41778","ssiphone_latitude":"43.5342","13":"43.5342","ssiphone_nomstation":null,"14":null,"ssiphone_voie":"","15":"","ssiphone_enseigne":"CASINO","16":"CASINO","ssiphone_codepostal":"13090","17":"13090","ssiphone_referencegps":"CASINO AIX EN PROVENCE","18":"CASINO AIX EN PROVENCE","distance":27.1}] EDIT: the response is coded like this in the server side : $stationsFinales=array(); $stationsFinales=$this->EpurationStations($stationsIdeales); sendResponse(200,json_encode($stationsFinales)); return true;
I don't know JSON very well but when I used it in my application, I solved a problem like this by using valueForKey: instead of objectForKey: and try to use this code: NSArray *array = [[request responseString] JSONValue]; for (int i = 0; i < [array count]; i++) { NSDictionary *stationEnCours = [array objectAtIndex:i]; NSLog(#"%#", [stationEnCours valueForKey:#"ssiphone_adresse"]); topStation.sstationAdress = [stationEnCours valueForKey:#"ssiphone_adresse"]; } adresseStation.text = [NSString stringWithFormat:#"%#", topStation.sstationAdress]; Consider this answer only as a test because, as I've said before, I don't know JSON very well. However, I hope this can help you like me!