I am using the read_csv method from pandas.
Say I am reading:
A,"B",C
With column names 1, 2, 3
I will get a dataframe of 3 columns, with the columns having values:
| 1 | 2 | 3 |
|---|---|---|
| A | B | C |
I want to get a dataframe of 4 columns:
| orig | 1 | 2 | 3 |
|---|---|---|---|
| A,"B",C | A | B | C |
For this scenario, re-creating the csv line from the 3 values is not possible as the parsing will already have discarded the quotes.
Is there a good way of doing this? I am currently directly manipulating the input to add the column to the incoming data, however I was hoping there was something within pandas itself that could help?