The only thing I added was the attempted concatenation of the file path.
I am getting an 'unexpected character after line continuation character, and cannot figure out why.
import numpy as np
import pandas as pd
import getpass
user = getpass.getuser()
data = pd.read_excel (r'C:\Users\' user '\Desktop\bulk export.xlsx',
sheet_name=1,
header=0)
df = pd.DataFrame(data,
columns= [1,'Record Type'])
print (df)
CodePudding user response:
You can try this:
import pathlib
from pathlib import Path
user = getpass.getuser()
my_file = Path(f"C:\\Users\\{user}\\Desktop\\bulk export.xlsx")
data = pd.read_excel (my_file, sheet_name=1, header=0)