I'm very novice, having only taken a few online Python courses. I was able to import an Excel file as follows:
import pandas as pd
df = pd.read_excel(r"T:\P&A\MVP\ABoutput.xlsx", sheet_name=['Report'], skiprows=[0])
print(df)
There is one word in row 1 of the file that I want to fix the spelling for. I've been googling solutions for the past 2 hours and nothing is working. I've tried str.replace, iloc, etc. No idea what I'm doing wrong. I can't find a solution on Stack, Udemy, "Automate the Boring Stuff", etc. Please could someone help?
Thanks!
Two possibilities:
Change Header Row
Let's say you load a table like so:
which gives you a data frame that prints like this:
You can use
rename.This results in the following:
Change Data Row
Let's say you load a table like so:
which gives you a data frame that prints like this:
You can access the data using
at(or many other ways).This results in the following:
General advice
Provide a minimal reproducible example (including mock data etc.), and read up on how to ask questions.