Jonnyboi
Jonnyboi

Reputation: 557

Pandas read_csv, reading in one column twice

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.

Upvotes: 1

Views: 170

Answers (1)

Raymond Toh
Raymond Toh

Reputation: 799

you can make a duplication after you read in the columns

Sample Code:

enterprise["stackoverflow_extra"] = enterprise["stackoverflow"]

Upvotes: 1

Related Questions