I have this multiple datasets that are needed to be processed by pandas.
DF 1:
DATE DATA1_ID DATA
20200101 XXX 123
20200102 YYY 456
...
DF 2:
DATE DATA2_ID DATA
20200101 AAA 098
20200102 BBB 765
...
What I want to achieve is to have a generic filter for those two tables like using df.loc[df.DATA1_ID == "XXX"] without having to change the columns names on either of the data frames.
I want to search this "ID" basing from the IDs columns that will work on both dataframes.
Sample behavior when running the script on both data frame:
- Filtering ID = XXX. Results would be DF 1: 20200101 XXX 123. DF 2:
- Filtering ID = AAA. Results would be DF 1: . DF 2: 20200101 AAA 098
- Filtering ID = OOO. Results would be DF 1: . DF 2: