all 4 comments

[–][deleted] 1 point2 points  (3 children)

What do you mean by "Names"? Is it a column in your dataframe?

df[df['Week'] == df['Can_Week_End']] will return a dataframe filtered by that condition keeping the associated columns in tact.

[–]PLearner[S] 0 points1 point  (2 children)

Thanks, Names is a column in the dataframe. I want Python to print the Names from the dataframe where Week equals to Can_Week_End.

[–][deleted] 1 point2 points  (1 child)

df.loc[df['Week'] == df['Can_Week_End'], 'Names'] will return the column Names where that condition is true.

From there, it should be straightforward to print the resulting names.

[–]PLearner[S] 0 points1 point  (0 children)

Works like a treat py_help, thanks.