简体   繁体   中英

How to represent nested values in a csv file? I want to seamlessly load the file into a (nested) python dictionary

My first thought is to chain csv files together through references. This will keep the information of each cell simple. A potential problem may arise if the chains become long and finding the correct csv file to edit becomes too complicated.

demographics:
    description: This is a description of demographics
        type: string
            value:
                ethnicity:
                        -a
                        -b
                        -c
    node: node801832
    somerandom:
        random1: 201901
        random2: lkk133

A column in popdemographics.csv
demographics        
description.csv     
node.csv        
somerandom.csv      


The csv file referenced by description.csv
description     
This is a description of demographics       
type.csv

This is not possible in csv. You might consider using YAML if you want readability for 'non-techies'

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM