Perhaps it was a quirk of language, but just to be clear, its not “the problem”, its “a problem”. If you change something get a different error message or different behavior, both of which were the case here, its usually a different problem and should be treated as such.
The proximate issue here is quite clear. Look at this line in your code
df = pd.read_csv(‘Desktop/Muhammad123.py’)
In particular, pay close attention to the file extension (the part after the dot). And what do you see in your “data table”? Is it the contents of the CSV file, or is it the contents of a different file? In general, if you’re not getting the content you expect, your first recourse should be to look at the file path and contents of the file, and see if it matches what is output by your code.
Again, to reduce the risk of this confusion and make it easier to move your project around, I highly recommend following the steps above to put both your code and your data in one project directory (say, named PythonExcel
or something else clear and appropriate for your project), set all your paths relative to that directory, and then ensure your working directory in Spyder, Jupyter, or your command prompt is set to that PythonExcel
directory. This is generally what is done in scientific computing and keeps things simpler, more organized and easy to follow vs. spreading everything around.
EDIT: As a tip, use triple backticks above and below your code, so it will display properly and be copy/pastable. In particular, this preserves indentation, which is syntactically and semantically very important in Python, as well as things like fancy quotes and formatting.
Like this:
```python
YOUR CODE HERE
```