Iβve been searching high and low for the best way to do a multi column groupby, i think.
Essentially i have a dataframe. with a multitude of columns but only 2 that matter in this contex.
I do a
g = groupby(df, :currencyA);
insertcols!(df, 1, :idA => g.groups)
which gets me a new column of id per currencyA column. something like
idA currencyA currency B
1 USD JPY
2 EUR USD
3 JPY EUR
I want to essentially create a second IdB column that follows the Id pattern generated from groupby of currencyA based on matching values in currencyB.
For example :
idA currencyA idB currency B
1 USD 3 JPY
2 EUR 1 USD
3 JPY 2 EUR
so IdB assigns the Idβs from A with the matching currency. Usd remains id 1 vs Eur remains id 2 etc. So i could track these currencies in whatever column by the same Id ref #.
if i were to groupby currencyB all over again japan would have in IdB a index of 1 and the others would follow sequentially.
I need to be able to track the same Id value based on the value of the currency. It probably makes no sense why i need this but unfort i do
REALLY appreciate the help. Been banging my head for a few days now.