Apr-06-2020, 04:51 PM
I am trying to create a file path from a string using os.path.normpath, however, I need a double \ at the beginning and this function doesn't allow this (from what I understand). Inside the pd.read_excel function I need the following: r'\\srpx\Folder\Data.xls'
Here is the code that is not working:
Here is the code that is not working:
import os
import pandas as pd
excel_string = str("r'\\srpx\Folder\Data.xls'")
excel_file = os.path.normpath(excel_string)
pd.read_excel(excel_file)By the way, this works perfectly:pd.read_excel(r'\\srpx\Folder\Data.xls')
