I want to write a code that checks two columns in a dataframe and compares them. one is supposed to be the Max Temp and the other is Min Temp. if values of Tmax column is less than the Tmin, then it should interchange the values. I need to do this for multiple files in a folder.
Date TMAX TMIN
1 01/01/1960 4.7353 -4.3722
2 01/02/1960 8.3800 11.0600
3 01/03/1960 3.4400 -3.5300
4 01/04/1960 -1.4300 -8.2200
5 01/05/1960 -1.9600 -5.0100
6 01/06/1960 4.5800 -6.3400
7 01/07/1960 -8.8900 -2.7300
after running the code, it should produce something like
Date TMAX TMIN
1 01/01/1960 4.7353 -4.3722
2 01/02/1960 11.0600 8.3800
3 01/03/1960 3.4400 -3.5300
4 01/04/1960 -1.4300 -8.2200
5 01/05/1960 -1.9600 -5.0100
6 01/06/1960 4.5800 -6.3400
7 01/07/1960 -2.7300 -8.8900