From 7d07d4e091eaf4c17ceffcd700dc2199e8b7fd5b Mon Sep 17 00:00:00 2001 From: Deepak Kumar Jha <58859859+LEGEND2310@users.noreply.github.com> Date: Sun, 30 May 2021 19:46:38 +0530 Subject: [PATCH] Updating the changed labels from CoinMarketCap data. In the load_data function from lines 79 to 83 the label values for each have been changed in the CoinMarketCap data to the following: * **percent_change_1h** to **percentChange1h** * ** percent_change_24h** to **percentChange24h** * **percent_change_7d** to **percentChange7d** * **market_cap** to **marketCap** * **volume_24h** to **volume24h** Also in line 109 made the code into single line to avoid confusion. --- app_6_eda_cryptocurrency/crypto-price-app.py | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app_6_eda_cryptocurrency/crypto-price-app.py b/app_6_eda_cryptocurrency/crypto-price-app.py index 3b2f474e..60b27d5d 100644 --- a/app_6_eda_cryptocurrency/crypto-price-app.py +++ b/app_6_eda_cryptocurrency/crypto-price-app.py @@ -26,7 +26,6 @@ st.title('Crypto Price App') st.markdown(""" This app retrieves cryptocurrency prices for the top 100 cryptocurrency from the **CoinMarketCap**! - """) #---------------------------------# # About @@ -77,11 +76,11 @@ def load_data(): coin_name.append(i['slug']) coin_symbol.append(i['symbol']) price.append(i['quote'][currency_price_unit]['price']) - percent_change_1h.append(i['quote'][currency_price_unit]['percent_change_1h']) - percent_change_24h.append(i['quote'][currency_price_unit]['percent_change_24h']) - percent_change_7d.append(i['quote'][currency_price_unit]['percent_change_7d']) - market_cap.append(i['quote'][currency_price_unit]['market_cap']) - volume_24h.append(i['quote'][currency_price_unit]['volume_24h']) + percent_change_1h.append(i['quote'][currency_price_unit]['percentChange1h']) + percent_change_24h.append(i['quote'][currency_price_unit]['percentChange24h']) + percent_change_7d.append(i['quote'][currency_price_unit]['percentChange7d']) + market_cap.append(i['quote'][currency_price_unit]['marketCap']) + volume_24h.append(i['quote'][currency_price_unit]['volume24h']) df = pd.DataFrame(columns=['coin_name', 'coin_symbol', 'market_cap', 'percent_change_1h', 'percent_change_24h', 'percent_change_7d', 'price', 'volume_24h']) df['coin_name'] = coin_name @@ -107,8 +106,7 @@ def load_data(): df_coins = df_selected_coin[:num_coin] ## Sidebar - Percent change timeframe -percent_timeframe = col1.selectbox('Percent change time frame', - ['7d','24h', '1h']) +percent_timeframe = col1.selectbox('Percent change time frame', ['7d','24h', '1h']) percent_dict = {"7d":'percent_change_7d',"24h":'percent_change_24h',"1h":'percent_change_1h'} selected_percent_timeframe = percent_dict[percent_timeframe]