1

Excel fileJupyter code

Hello I want to read an excel file in python using pandas. Because later I want to add values that file. However I can not read it properly because I have merged columns ,every label consists of 2 column. I searched it but did't find anything usefull.

3
  • all the columns look completely empty Commented Jun 20, 2020 at 9:46
  • i know, but the label column is the problem, After "Tarix" column there are two unnamed columns, but they must be "Tarix" this name Commented Jun 20, 2020 at 9:49
  • I just tried with an excel document with merged rows but your function is working. It seems to be something about the document. But I'm happy that the awnser works for you :) Commented Jun 20, 2020 at 10:09

1 Answer 1

2
df = pd.read_excel(r'C:/Users/USER1/Desktop/report.xlsx')
df = df.reset_index()
df = df.drop(labels = df.filter(regex = 'Unnamed').columns, axis = 1)
df
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.