I have a dataframe with 5000 records.
Data:
Month Heat Number wts gcs
1 HA 8.2 98
1 HB 7.6 86
2 HB 4.2 76
3 HC 6.9 46
4 HD 7.4 36
5 HD 9.8 26
6 HF 10.8 16
The 2nd letter of the Heat number column denotes month.
A for January
B for Feb
C for March and so on..
Condition:
If the record in month column is 1 , the corresponding value in heat number column should always be 'HA'
If month is 2, the corresponding value in heat number column should always be 'HB'
If month is 3, the corresponding value in heat number column should always be 'HC'
If month is 4, the corresponding value in heat number column should always be 'HD'
If month is 5, the corresponding value in heat number column should always be 'HE'
Any records with incorrect match should be deleted(that entire row in the dataframe should be deleted) Example in the data the 2nd row should be deleted since the month is 1 and heat number is HB(heat number should have been HA)
Desired Output:
Month Heat Number wts gcs
1 HA 8.2 98
2 HB 4.2 76
3 HC 6.9 46
4 HD 7.4 36
6 HF 10.8 16