STEEM POWER retention ratio of top 50 witnesses

by joviansummer original STEEMIT post: https://steemit.com/blog/@joviansummer/steem-power-retention-ratio-of-top-50-witnesses Hello, this is @joviansummer(witness: @jswit). Some time ago there was a bit of discussion on discord witness chanel about witnesses' power-down/cashing-out. So out of curiosity I just checked current ratio of witnesses' own STEEM POWER(VESTS) and all-time producer reward(VESTS). The ratio is calculated by the following simple formula: ratio(%) = account's own SP(MV) / all-time producer reward SP(MV) * 100% Ratio value less than 100% indicates power-down. If witness does additional power-up or gets other types of reward(e.g., curation reward), the ratio may exceed 100%. This does not take witness' other accounts into consideration. All-time producer reward data is from @steemchiller's SDS API. Here is the result: rank account own_sp prod_sp ratio 1 justyy 2188.411MV 1284.2MV 170.41% 2 steemchiller 982.134MV 124...

파이썬 딕셔너리(dict)에서 원소 추가/제거

by joviansummer
original STEEMIT post: https://steemit.com/blog/@joviansummer/dict


파이썬에서 key:value 형태로 구성된 딕셔너리(dict)에서 특정 키(key)에 대응하는 원소를 추가/제거하는 방법입니다.

원소 추가는 간단합니다. 변수를 딕셔너리 형식으로 초기화한 후에 원소를 할당해 주면 됩니다.

# x_dict 변수 초기화(딕셔너리 형식)
x_dict = {}
# 원소 추가 - 키 'abc', 값 100
x_dict['abc'] = 100
# 2개 더 추가
x_dict['def'] = 50
x_dict['xyz'] = 99

당연히 아래와 같이 변수 x_dict의 내용을 한번에 할당해도 됩니다.

x_dict = { 'abc':100, 'def':50, 'xyz':99 }

이제 제거해 보겠습니다. x_dict에서 키 'def'에 대응하는 원소를 제거하려면 pop()을 사용합니다. 아래와 같습니다.

x_dict.pop('def')

이제 x_dict의 내용을 확인해 보면 해당 원소가 사라진 것으로 볼 수 있습니다.

print(x_dict)

{'abc': 100, 'xyz': 99}

제거하면서 해당 원소를 다른 변수에 할당할 수 있습니다. 이번에는 키 'xyz'에 대응하는 원소를 제거하면서 이 값을 변수 y에 할당해 봅니다.

y = x_dict.pop('xyz')

키 'xyz'에 대응하는 값은 99였으므로, 변수 y에 99가 할당되고 x_dict에서는 이 원소가 제거되었습니다.

print(y)

99

print(x_dict)

{'abc': 100}

Comments

Popular posts from this blog

스티미언의 영향력 지수 계산

jsup/avle code update - you don't have to write post everyday

jsup/avle 보팅 코드 갱신 - 1일1포스팅 강박에서 벗어나기