When I run my script from the IDE I don't get a problem. But when I run it using python -m cProfile <script_file_name>
it raises a FileNotFoundError?
import pandas as pd
x = pd.read_excel(<file_name>)
I managed to find a way solution from Youtube (Channel Name: mCoding) :
import cProfile, pstats, pandas
with cProfile.Profiel() as pr:
pandas.read_excel(<File_Name>)
stats = pstats.Stats(pr)
stats.dump_stats(filename="<stats_file_name>.prof")
and in the terminal do:
snakeviz <stats_file_name>.prof
As @Grady Player mentioned in the comment, it's probably a relative path issue.
First of all, try the file's full path; for example: "D:\some_folder\a.xlsx"
If it works, it means you are setting the path wrongly at first place.
Then, you may try to run following code for learning your IDE's working directory.
It surely gives you an idea about the relative path, so that you can create the relative path correctly.
Also, you can check this post about the
FileNotFoundError
.