I want to create a custom choropleth map for USA in which instead of showing states individually, I'd like to combine some states together e.g. Louisiana, Mississippi, Alabama, and Arkansas.
Below is some sample code with data from Folium github page. I tried to add a column named "region" to state_data which was set to unique values for all other states except the ones indicated above and changed the columns argument in folium.Choroplet to region but that didn't work either. Open to using another package besides folium (plotly etc.).
Sample Code:
import folium
import pandas as pd
sample_map = folium.Map(location=[40, -95], zoom_start=4)
url = (
"https://raw.githubusercontent.com/python-visualization/folium/main/examples/data"
)
state_geo = f"{url}/us-states.json"
state_unemployment = f"{url}/US_Unemployment_Oct2012.csv"
state_data = pd.read_csv(state_unemployment)
folium.Choropleth(
geo_data=state_geo,
name="choropleth",
data=state_data,
columns=["Region", "Unemployment"],
key_on="feature.id",
fill_color="YlGn",
fill_opacity=0.7,
line_opacity=.1,
legend_name="Unemployment Rate (%)",
).add_to(sample_map)
folium.LayerControl().add_to(sample_map)
sample_map.save('test.html')

You are using a JSON that describes the US states with JSON data. You can modify this JSON to combine all of the desired states into a "South Central" region, while preserving the code you have already written. By representing all four states as one state, and combining their unemployment rate, you can use Folium and get the desired outcome.
Combining geojson data is pretty difficult to do manually, so I would recommend using a sophisticated tool like QGIS to combine the four states. You can import the JSON to QGIS, select the desired states, and click "Merge Selected Features" as shown here:
Merging all the states creates the following:
Great, that is what we want- the new quad-state. After this, you can export is as a geojson file and use this for the geographical data of the US.
You can adjust this code to use the new geojson data. I have connected this JSON to my Github for ease of download and reference since I can't post a massive JSON here, and have referenced the Github file in my code. Along with merging the geodata for the JSON, you also need to combine unemployment rates for the given states. I have used the new geojson and combined rates in my code:
With the new GeoJSON data, you can see all states combined, with combined unemployment:
Note that zooming in will still show states names, but theres will not be a hard-defined border, and unemployment rates represents an average of all the specified states so they all share the same value. You can see that Tennessee looks similar to the quad-state, but it has a thicker state line than the quad states; it is purely coincidence that the color is the same, as it has a similar unemployment rate to the quad average. Also, in the GeoJSON I provided, I combined all states into one called "Alabama"- I realize this may be confusing, and you may want to modify it to be something like "South Central Region".