Home > Net >  Pandas read_csv, reading in one column twice
Pandas read_csv, reading in one column twice

Time:09-16

I have a csv I want to read in, I want to bring in the same column twice as later on ill be changing the column name and doing some manipulation on one of them. Is there a way to read the column in twice?

My following code will only reads it in once:

include_cols = ['stackoverflow','stackoverflow']
enterprise = pd.read_csv(url,encoding = 'unicode_escape', sep="|", usecols=include_cols)

Thanks.

CodePudding user response:

you can make a duplication after you read in the columns

Sample Code:

enterprise["stackoverflow_extra"] = enterprise["stackoverflow"]
  • Related