Skip to content

Instantly share code, notes, and snippets.

@redavis22
Created May 6, 2023 01:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save redavis22/e693beef1a0776c151d026b221f699bd to your computer and use it in GitHub Desktop.
Save redavis22/e693beef1a0776c151d026b221f699bd to your computer and use it in GitHub Desktop.
streamlit hurricane shopping items
import pandas as pd
import streamlit as st
from faker import Faker
import random
# Set up the Faker object
fake = Faker()
# Create a list of hurricane names
hurricane_names = [fake.city() + ' Hurricane' for _ in range(3)]
# Create a list of items with emojis
items = ['๐Ÿ’ง Bottled Water', '๐Ÿฅซ Canned Food', '๐Ÿ”ฆ Flashlights', '๐Ÿ”‹ Batteries', '๐Ÿฉน First Aid Kit',
'๐Ÿ”ช Utility Knife', '๐Ÿ“ป Portable Radio', '๐Ÿ› ๏ธ Tool Kit', '๐Ÿงญ Compass', '๐Ÿงฏ Fire Extinguisher',
'๐Ÿ‘– Clothing', '๐Ÿ›๏ธ Sleeping Bag', '๐Ÿšฐ Water Purifier', '๐Ÿงผ Soap', '๐Ÿšฝ Toilet Paper',
'๐Ÿงน Broom', '๐Ÿšช Door Lock', '๐Ÿ”‘ Keys', '๐Ÿ”จ Hammer', '๐Ÿ”ฉ Nails',
'๐Ÿงฐ Power Drill', '๐Ÿงน Dustpan', '๐Ÿšง Road Cones', '๐Ÿšซ Danger Tape', '๐Ÿš‘ First Aid Kit',
'๐Ÿงฏ Fire Blanket', '๐Ÿ—บ๏ธ Maps', '๐Ÿ”ฎ Flashlight', '๐Ÿ“ฑ Solar Charger', '๐Ÿ”† Batteries',
'๐Ÿ”Œ Generator', '๐Ÿ” Binoculars', '๐ŸŒฌ๏ธ Fan', '๐ŸŽ’ Backpack', '๐Ÿงน Sweeper',
'๐Ÿงบ Laundry Bag', '๐Ÿฅพ Hiking Boots', '๐Ÿ‘• T-Shirts', '๐Ÿ‘– Jeans', '๐Ÿ‘Ÿ Sneakers',
'๐Ÿงข Hat', '๐Ÿ•ถ๏ธ Sunglasses', '๐Ÿงค Gloves', '๐Ÿงฃ Scarf', '๐Ÿ‘ฉ<200d>๐Ÿฆฑ Hair Brush']
# Create an empty dictionary to store the data
data = {'Item': items}
# Loop through the hurricane names and add a random number of items for each hurricane
for hurricane in hurricane_names:
num_items = [random.randint(10, 100) for _ in range(len(items))]
data[hurricane] = num_items
# Create a DataFrame from the data dictionary
df = pd.DataFrame(data)
df.set_index('Item', inplace=True)
# Create a Streamlit chart
st.line_chart(df)
# Create a Streamlit chart
st.bar_chart(df)
# Create a DataFrame from the data dictionary
df = pd.DataFrame(data)
df.set_index('Item', inplace=True)
# Calculate the cumulative sum of the item counts for each hurricane
cumulative_data = df.cumsum()
# Create an area chart of the cumulative data
st.area_chart(cumulative_data)
~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment