0

I'm using python 3.x. I need to apply encoding in my pandas data frame which contains 2391653 rows & 35 columns. I need to apply endcoding only for name column. So I tried this code

df1=df.Name.str.encode('utf-8-sig') 

But df1 is storing only name column. Can you please suggest me how to apply encoding only for 1 column & remaining columns will be unchanged?

1 Answer 1

1

You are currently creating a new dataframe df1 with only the column 'Name' of df with the encoding applied.

You should try to create a new column in df instead:

df['New_Name'] = df.Name.str.encode('utf-8-sig')

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.