Greetings,
> I should've mentioned that I want to import my csv as a data frame or numpy
> array or as a table.
If you know the max length of a row, then you can do something like:
def gen_rows(stream, max_length):
for row in csv.reader(stream):
yield row + ([None] * (max_length - len(line))
max_length = 10
with open('data.csv') as fo:
df = pd.DataFrame.from_records(gen_rows(fo, max_length))
HTH,
Miki
--
https://mail.python.org/mailman/listinfo/python-list
