I have a problem and need to solve it using Pandas/Python. Not sure how to achieve it and would be great if someone help here to build the logic.
I have to generate the output file as below:
df = pd.DataFrame({'priority': [1, 1, 1, 2, 2, 3],'db_name': ['corp', 'corp', 'corp', 'sales', 'sales', 'market'],'tbl_name': ['c_tbl1', 'c_tbl1', 'c_tbl1', 's_tbl1', 's_tbl2', 'm_tbl1'],'partition': ['202301', '202302', '202303', '202301', '202302', '202301'],'size_gb': [5, 5, 10, 1, 2, 3]})
Logic would be like this for priority 1 - three entries presents with different sizes, if the size is 10 GB single entry in output file with t_size = XL or sump of the size create single entry with t_size = XL similarly for other priorities size is less than 3 GB then t_size = S otherwise M.
I tried to loop using Pandas data frames, couldn't proceed as I am not proficient in Python.