My sample DataFrame is:
| file | Voucher_stand |
|---|---|
| 90.txt | SCA |
| 90.txt | SCB |
| 60.txt | WFA |
| 60.txt | WFO |
| 90.txt | SCA |
| 50.txt | SCA |
| 80.txt | SCA |
| 100.txt | SCA |
I want to define a dictionary based on which I can select some columns, but each file has its own code in the Voucher_stand column, how can I filter this DataFrame by dictionary based on Voucher_stand and file instead of using the list every time?
For example, define Voucher_Stand and files in a dictionary and then filter my DataFrame based on this dictionary:
code = {'90.txt':['SCA', 'SCB'], '60.txt':['WFA', 'WFO']}