I am getting the following error "Error: line contains NULL byte" when trying to read and covert a CSV column into a dictionary list within Python.
I have followed list contains NULL byte, CSV DictReader but this doesn't seem to work with the code I have written.
import pandas as pd
import csv
from collections import defaultdict
columns = defaultdict(list)
with open('file.csv') as f:
reader = csv.DictReader(f)
for row in reader:
for (k,v) in row.items():
columns[k].append(v)
keywords = print(columns['Keyword'])
Any help would be appreciated! Thanks.