I am trying to test whether a column is named something specific (and then I would like to do the same with row name). Hence is it possible to loop through each column name to see if it's equal something?
Example:
dataframe:
Jan Feb Mar
Jan 0 0 0
Feb 0 0 0
Mar 0 0 0
Logic: Loop through each column to find if it's called "Jan" and loop through each row to see if it's called "Feb". If the logic is met then put 1 in equivalent col/row. E.g.
Final dataframe:
Jan Feb Mar
Jan 0 0 0
Feb 1 0 0
Mar 0 0 0
Thanks!
Aucun commentaire:
Enregistrer un commentaire