MCPcopy Create free account
hub / github.com/python-visualization/folium / setup_data

Function setup_data

tests/test_folium.py:28–42  ·  view source on GitHub ↗

Import economic data for testing.

()

Source from the content-addressed store, hash-verified

26
27
28def setup_data():
29 """Import economic data for testing."""
30 with open(os.path.join(rootpath, "us-counties.json")) as f:
31 get_id = json.load(f)
32
33 county_codes = [x["id"] for x in get_id["features"]]
34 county_df = pd.DataFrame({"FIPS_Code": county_codes}, dtype=str)
35
36 # Read into Dataframe, cast to string for consistency.
37 df = pd.read_csv(os.path.join(rootpath, "us_county_data.csv"), na_values=[" "])
38 df["FIPS_Code"] = df["FIPS_Code"].astype(str)
39
40 # Perform an inner join, pad NA's with data from nearest county.
41 merged = pd.merge(df, county_df, on="FIPS_Code", how="inner")
42 return merged.fillna(method="pad")
43
44
45def test_location_args():

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…