Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -2,6 +2,13 @@ import streamlit as st
|
|
2 |
import pandas as pd
|
3 |
import plotly.express as px
|
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
# Streamlit app
|
6 |
st.title('Top Corporations by State in the United States')
|
7 |
|
@@ -22,10 +29,3 @@ if display_map_button:
|
|
22 |
# Use the default CSV file if no files are uploaded
|
23 |
data = pd.read_csv('corporations_data.csv')
|
24 |
st.plotly_chart(plot_map(data))
|
25 |
-
|
26 |
-
# Function to plot the map
|
27 |
-
def plot_map(data):
|
28 |
-
fig = px.choropleth(locations=data['State'], locationmode="USA-states", color=data['Revenue'],
|
29 |
-
scope="usa", title="Top Corporations by State in the United States",
|
30 |
-
hover_name=data['Corporation'], hover_data=['Revenue'])
|
31 |
-
return fig
|
|
|
2 |
import pandas as pd
|
3 |
import plotly.express as px
|
4 |
|
5 |
+
# Function to plot the map
|
6 |
+
def plot_map(data):
|
7 |
+
fig = px.choropleth(locations=data['State'], locationmode="USA-states", color=data['Revenue'],
|
8 |
+
scope="usa", title="Top Corporations by State in the United States",
|
9 |
+
hover_name=data['Corporation'], hover_data=['Revenue'])
|
10 |
+
return fig
|
11 |
+
|
12 |
# Streamlit app
|
13 |
st.title('Top Corporations by State in the United States')
|
14 |
|
|
|
29 |
# Use the default CSV file if no files are uploaded
|
30 |
data = pd.read_csv('corporations_data.csv')
|
31 |
st.plotly_chart(plot_map(data))
|
|
|
|
|
|
|
|
|
|
|
|
|
|