-3

I'm importing data from excel with pandas. A column of my dataframe contains some strings of numbers with 0 as the first character and python transforms it into integer. For example 0700 is placed 700. How to not alter the value and consider it as a string with 0 in front?

1

1 Answer 1

0

By using the 'converters' parameter on your dataframe statement, e.g.

df = pd.read_excel('*workbook name here',sheetname='*sheet name here',header=0,converters={'*integer column name here':str})
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.