Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create a pandas data frame called df_rates from the unemployment data source in the Jupyter notebook and add a new field to the data frame
Create a pandas data frame called df_rates from the unemployment data source in the Jupyter notebook and add a new field to the data frame called rate_emp, setting its values equal to 1 - rate:
1 ! pip install altair vega_datasets i import altair as alt 2 import pandas as pd 3 import numpy as np 4 from vega_datasets import data 1 # Data Sources 2 counties = alt.topo_feature(data.us_10m.url, 'counties') 3 source = data.unemployment.url 4 5 df_rates 6 df_rates - pd. DataFrame (source) 7 print (df_rates) 1 # counties 2 id geometry_fields 3 1000 Polygon 5 alt.Chart(counties).mark_geoshape (stroke='white').encode 6 tooltip-['id:0') ) - project type='albersusa' 9).properties 10 width=600, height=400 7 8 11 12 ) 13 14 1 # source 2 id rate 3 1000 0.03 4 5 pd.read_csv (source, delimiter-'\t') 2 1 ch_map - alt.Chart(counties).mark_geoshape().encode color='rate:O', 3 tooltip=['id:o', 'rate:Q'] 4 ).transform_lookup 5 lookupe'id', from_=alt.LookupData(source, 'id', ['rate']) 7). project type='albersusa' 9).properties width=600, 11 height=400 6 8 10 12 ) 13 14 ch mapStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started