---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-6-5902626c5fa9> in <module>
2 from io import StringIO
3 csv_diff.compare(csv_diff.load_csv(StringIO("id,a,b,c. c,d\n0,2,3,4,5"), key="id"),
----> 4 csv_diff.load_csv(StringIO("id,a,b,c. c,d\n0,2,4,5,5"), key="id"))
~/anaconda3/envs/py37/lib/python3.7/site-packages/csv_diff/__init__.py in compare(previous, current)
65 "changes": {
66 field: [prev_value, current_value]
---> 67 for _, field, (prev_value, current_value) in d
68 },
69 }
~/anaconda3/envs/py37/lib/python3.7/site-packages/csv_diff/__init__.py in <dictcomp>(.0)
65 "changes": {
66 field: [prev_value, current_value]
---> 67 for _, field, (prev_value, current_value) in d
68 },
69 }
TypeError: unhashable type: 'list'
From what I can understand, for some reason when the column name contains ., the field become a list instead of a str (e.g. ["c. c."] instead of "c. c"), and it breaks the construction of the dictionary.
Consider the following example, which works correctly:
Output:
If I add a
.
inside the column name of "c c" -> "c. c" it breaksOutput:
From what I can understand, for some reason when the column name contains
.
, thefield
become alist
instead of astr
(e.g.["c. c."]
instead of"c. c"
), and it breaks the construction of the dictionary.