'I can't modify excel data I read from python
I am currently trying to develop a program, to use it I need to read data from an excel with Pandas. The problem is that once I open Anaconda and Jupiter and run the program it won't let me go back to modify the excel it gets data from. The program works and reads initial data, but I can't modify the excel sheet and save it for the program to run with other input data.
excel=pd.ExcelFile(r'C:\Users\ADURAN3\Anaconda3\python.xlsx')
df=pd.read_excel(excel,'Sheet1',index_col=0)
When I try to save the excel sheet with the new changes it forces me to rename it.
I would love it if you could help me, I am very new to pyhton.
Thank you very much.
Solution 1:[1]
To read an excel file, you don't need to do pd.ExcelFile(r'C:\Users\ADURAN3\Anaconda3\python.xlsx')
Just putting your file path into read_excel will work:
df = pd.read_excel(r'C:\Users\ADURAN3\Anaconda3\python.xlsx','Sheet1',index_col=0)
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Emi OB |
