uneven csv with mixed datatypes

8 views
Skip to first unread message

keshav3...@gmail.com

unread,
Jun 10, 2018, 2:34:53 PM6/10/18
to PyData
Hi,

Encountered the following data in a csv

1,2,3,4,5,,,
a,3,4,t,y,....
1,2,3
3,y,t,,,,,,


moto is to just drop this data as is into sqllite , any hints on this.

Regards,
Keshav

Joris Van den Bossche

unread,
Jun 11, 2018, 3:14:19 AM6/11/18
to PyData
What is your desired result?

You have some options with read_csv to skip lines with less values, or to select certain columns, eg see http://pandas.pydata.org/pandas-docs/stable/io.html#handling-bad-lines

Joris

--
You received this message because you are subscribed to the Google Groups "PyData" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pydata+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Julien Marrec

unread,
Jun 11, 2018, 3:19:20 PM6/11/18
to pyd...@googlegroups.com
From the example you give (and accepting that I know nothing about your data), it looks like “....” might be there to indicate that the row continues on the following line (some older programs still have 80 char limits...), in which case you could just preprocess the CSV to reconstruct proper lines.

——
Sent from a mobile device, please excuse the brevity.

Julien Marrec, EBCP, BPI MFBA
Owner
EffiBEM

Direct: +33 6 95 14 42 13
Website: www.effibem.com

LinkedIn (en) | (fr)

To unsubscribe from this group and stop receiving emails from it, send an email to pydata+un...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages