I have a dataframe:
bq_selection_id bq_balance bq_market_id bq_back_price
0 45094462 185.04 155 1.87
1 45094462 185.04 155 1.97
2 45094463 185.04 155 3.05
3 45094463 185.04 156 3.05
4 45094464 185.04 156 5.80
5 45094464 185.04 156 5.80
6 45094466 185.04 157 200.00
7 45094466 185.04 157 200.00
8 45094465 185.04 157 NaN
9 45094465 185.04 157 NaN
I would like to have two extra columns second_lowest, none_values both of them per group, groupby market id. Another words for market id 155 second_lowest 1.97 and there are no NaN values therefore none_values is False. I would like to get something like:
bq_selection_id bq_balance bq_market_id bq_back_price second_lowest none_val
0 45094462 185.04 155 1.87 1.97 False
1 45094462 185.04 155 1.97 1.97 False
2 45094463 185.04 155 3.05 1.97 False
3 45094463 185.04 156 3.05 5.80 False
4 45094464 185.04 156 5.80 5.80 False
5 45094464 185.04 156 6.40 5.80 False
6 45094466 185.04 157 1.00 1.70 True
7 45094466 185.04 157 1.70 1.70 True
8 45094465 185.04 157 NaN 1.70 True
9 45094465 185.04 157 NaN 1.70 True
Can you help me with this, please?
1.70
forbq_market_id == 157
?