Skip to content

Commit

Permalink
test blocks and nces; add docstring for bea
Browse files Browse the repository at this point in the history
  • Loading branch information
knaaptime committed Jan 18, 2024
1 parent 62c2c11 commit b2cdf4e
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .ci/39.yml → .ci/312.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: test
channels:
- conda-forge
dependencies:
- python =3.9
- python =3.12
- pandas
- giddy >=2.2.1
- libpysal
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/unittests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ jobs:
matrix:
os: [ubuntu-latest]
environment-file:
- .ci/39.yml
- .ci/310.yml
- .ci/10.yml
- .ci/311.yml
- .ci/312.yml
include:
- environment-file: .ci/310.yml
- environment-file: .ci/311.yml
os: macos-latest
- environment-file: .ci/310.yml
- environment-file: .ci/311.yml
os: windows-latest
defaults:
run:
Expand Down
1 change: 1 addition & 0 deletions docs/api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ available quickly with no configuration by accessing methods on the class.

DataStore
DataStore.acs
DataStore.bea_regions
DataStore.blocks_2000
DataStore.blocks_2010
DataStore.blocks_2020
Expand Down
8 changes: 8 additions & 0 deletions geosnap/_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ def __init__(self, data_dir="auto", disclaimer=False):
def __dir__(self):
atts = [
"acs",
"bea_regions",
"blocks_2000",
"blocks_2010",
"blocks_2020",
Expand Down Expand Up @@ -107,6 +108,13 @@ def show_data_dir(self, verbose=True):
return self.data_dir

def bea_regions(self):
"""Table that maps states to their respective BEA regions
Returns
-------
pandas.DataFrame
BEA region table
"""
return pd.read_csv(
os.path.join(
os.path.dirname(os.path.abspath(__file__)), "io/bea_regions.csv"
Expand Down
32 changes: 32 additions & 0 deletions geosnap/tests/test_datastore.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,3 +52,35 @@ def test_msa_defs():
def test_codebook():
df = datasets.codebook()
assert df.shape == (194, 12)

def test_bea():
df = datasets.bea_regions()
assert df.shape == (51, 4)

def test_blocks_2000():
df = datasets.blocks_2000(states=['11'])
assert df.shape == (5674, 3)

def test_blocks_2010():
df = datasets.blocks_2010(states=['11'])
assert df.shape == (6507, 5)

def test_blocks_2020():
df = datasets.blocks_2020(states=['11'])
assert df.shape == (6012, 7)

def test_ejscreen():
df = datasets.ejscreen(states=['11'], year=2019)
assert df.shape==(450, 368)

def test_nces_schools():
d = datasets.nces(dataset='schools', year='1516')
assert d.shape == (102209, 26)

def test_nces_districts():
d = datasets.nces(dataset='school_districts')
assert d.shape == (13352, 18)

def test_nces_sabs():
df = datasets.nces(dataset='sabs')
assert df.shape == (75128, 15)

0 comments on commit b2cdf4e

Please sign in to comment.