Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
import plotly.graph_objs as go
import pandas as pd
import numpy as np
df = pd.read_csv("Real Estate Data YOY .csv")
print(df.head())
i = 0
cols = [col for col in df.columns]
cols = cols[1:]
for col in cols:
fig = go.Figure(data=go.Choropleth(
locations=df['State'], # Spatial coordinates
z = df[col].astype(float), # Data to be color-coded
locationmode = 'USA-states', # set of locations match entries in `locations`
colorscale = 'viridis',
showscale=True,
))
fig.update_layout(
title_text = 'Percent Change In Sales Price - ' + str(col),
geo_scope='usa', # limite map scope to USA
)
fig.write_image(f"delta{i}.png", width=1920, height=1080)
i += 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.