Skip to content

Tag: excel

Name ‘ ‘ is not defined – python

from bunch of files I want to extract some info (code is below), but I came across error: “name ‘GH_Pos21X_true’ is not defined”, full error: Where should I defined it? Code: I can’t see a problem, maybe someone could help me find my mistake? I will be grateful. If I don’t …

Converting Excel to PDF with pywin32 [Error]

I try to export one of my xlsx files as PDF with pywin32: Unfortunately I get this com_error: In the end I want to do use this conversion on 30 xlsx files at once. I know how to write the loop for this but can not fix the above mentioned error. Answer When using Python paths on Windows, you need

Pandas Set Index Based On Column Value

I’m new to pandas, I have a Dataframe read from excel file, like this screenshot below where Products is the header and Google and Meta is the group (index) Using pandas I would like the dataframe to be like this Thank You Answer Using pd.assign and np.where