I have a dataframe with 4 columns: NAME, VAL1, VAL2, COST. The COST column has values stored as dictionary.
NAME    VAL1    VAL2     COST
----------------------------------------------------------------------------
BACD    259.35  267.00  {'COST[2]': [256.12], 'COST[5]': [257.72], 'COST[16]': [266.3]}
BACD    256.00  257.95  {'COST[2]': [255.27], 'COST[5]': [257.91], 'COST[16]': [266.3]}
BACD    257.90  262.00  {'COST[2]': [258.15], 'COST[5]': [258.82], 'COST[16]': [266.3]}
BACD    260.10  261.40  {'COST[2]': [260.32], 'COST[5]': [257.75], 'COST[16]': [266.3]}.
BACD    260.45  264.90  {'COST[2]': [261.58], 'COST[5]': [258.83], 'COST[16]': [266.3]}
Need an Output as below where df.COST=='COST[5],
NAME    VAL2     COST
-----------------------
BACD    267.00  257.72
BACD    257.95  257.91
BACD    262.00  258.82
BACD    261.40  257.75
BACD    264.90  258.83
Tried with the below query, but it doesn't work
print(df[(df.NAME=='BACD') & (df.COST=='COST[5]')][['NAME', 'VAL2', 'COST']]) 
what would be the valid query?
 
     
    