B
Size: a a a
B
B
B
NK
In [66]: df.colour.value_counts(normalize=True)
Out[66]:
Blue 0.333333
Black 0.208333
In [67]: round(0.333333 * 100, 2)
Out[67]: 33.33
B
B
B
EB
B
In [66]: df.colour.value_counts(normalize=True)
Out[66]:
Blue 0.333333
Black 0.208333
In [67]: round(0.333333 * 100, 2)
Out[67]: 33.33
def get_plus_100(s):
return s+100
B
df1[0].value_counts(normalize=True).apply(get_plus_100)B
0.562774 100.00001
0.075313 100.00001
0.065589 100.00001
0.506593 100.00001
0.520936 100.00001
0.623515 100.00001
0.016935 100.00001
0.973538 100.00001
Name: 0, Length: 100000, dtype: float64
B
df.colourB
B
self._compile_rules() ?EB
B
B
def _compile_rules(self):
def get_method(method):
if callable(method):
return method
elif isinstance(method, six.string_types):
return getattr(self, method, None)
self._rules = [copy.copy(r) for r in self.rules]
for rule in self._rules:
rule.callback = get_method(rule.callback)
rule.process_links = get_method(rule.process_links)
rule.process_request = get_method(rule.process_request)
B
In [66]: df.colour.value_counts(normalize=True)
Out[66]:
Blue 0.333333
Black 0.208333
In [67]: round(0.333333 * 100, 2)
Out[67]: 33.33
EB