Reading csv containing a list in Pandas

前端 未结 4 1396
星月不相逢
星月不相逢 2020-12-14 11:09

I\'m trying to read this csv into pandas

HK,\"[u\'5328.1\', u\'5329.3\', \'2013-12-27 13:58:57.973614\']\"
HK,\"[u\'5328.1\', u\'5329.3\', \'2013-12-27 13:5         


        
4条回答
  •  时光取名叫无心
    2020-12-14 11:42

    use .strip() in python.

    with open(csvfile, 'r')as infile:
        reader = csv.reader(infile)
        for row in reader:
            col1 = row[0]
            col2 = row[1:].strip("[]")
    

提交回复
热议问题