I am using the following code to import a xlsx flat file:
master = pd.read_excel("H:/Python_data/profit_US_07 2023.xlsx",skiprows=[0])
I would like to create an alias called infile_nyc having the value of "profit_US_07 2023.xlsx" so that I can use it to import the file
master = pd.read_excel("H:/Python_data/infle_nyc",skiprows=[0]).
When I try it, I get:
FileNotFoundError: [Errno 2] No such file or directory: 'H:/Python_data/Nyc_infile'. It does not recognize the string.
Thank you for your help
It seems like there might be a typo in your code. You mentioned that you want to create an alias called "infile_nyc" with the value "profit_US_07 2023.xlsx," but it appears that the alias you're using in the pd.read_excel function is different from what you intended.
To create an alias and use it to import the file correctly, you should do the following:
In this code, you first define the alias infile_nyc with the correct file path and filename. Then, you use this alias in the pd.read_excel function to read the Excel file. This should resolve the issue, and Python will correctly recognize the string you intended to use as the file path and name.