#?????????, ???? ?? ??????, ????? refundable_support ??? nonrefundable_support ?? ???????, ? budget=0
err_budget = data.query('(budget < refundable_support) or (budget < nonrefundable_support)')
len(err_budget)
#?.?. ?????? ?? ?.?. = 0, ???? ????????? ?? ????? 0, ?? ????? ??????????? ????????? ???????? ? #??????? "??????" (??? ?????? =0, ? ???? ?? ????????? ?? ????? 0) ?? ???????:
#"(???????.????????? + ?????????.?????????) / ?? ????????? ???????? ???? ????????? ? ???????".
import numpy as np
budget_less_5mln = data.query('budget < 5000000')
len(budget_less_5mln)
#???? 17 ????? ??? ?????? ?????? ?????? ???.????????? ? ???? ???.????????? ? ??????? ????? ??? ??????? ???????. ??????? ?????????? ??????? ???? ???.???????? ??? ???? ????????
budget_more_5mln = data.query('budget > 5000000')
len(budget_more_5mln)
dolyaya = (((budget_more_5mln['refundable_support'] + budget_more_5mln['nonrefundable_support']) / budget_more_5mln['budget']) * 100).apply(np.ceil)
med = dolyaya.median()
med
data.loc[(data['budget'] < data['refundable_support']) | (data['budget'] < data['nonrefundable_support']), 'budget'] = (data['refundable_support'] + data['nonrefundable_support']) / med
#? ??????? ? ???? 17 ??????? ???????? ??????? (??? budget < 5000000) ??? ?? ?? ??????? "(???????.????????? + ?????????.?????????) * ?? ????????? ???????? ???? ????????? ? ???????"
data.loc[(data['budget'] < 5000000) & (data['budget'].notna()), 'budget'] = (data['refundable_support'] + data['nonrefundable_support']) / med
data.loc
From Chocolate Cat, 4 Months ago, written in Plain Text, viewed 102 times.
This paste is a reply to data.loc from Social Motmot
- go back
URL http://codebin.org/view/3f0a954e/diff
Embed
Viewing differences between data.loc and data.loc
— Expand Paste to full width of browser