Skip to content

Commit 3780c5e

Browse files
authored
Merge pull request #377 from cmu-delphi/usafacts-docs
Update usafacts docstrings to pass pydocstyle
2 parents abce794 + 13867d2 commit 3780c5e

File tree

3 files changed

+8
-9
lines changed

3 files changed

+8
-9
lines changed

usafacts/delphi_usafacts/geo.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ def disburse(df: pd.DataFrame, pooled_fips: str, fips_list: list):
6161

6262
def geo_map(df: pd.DataFrame, geo_res: str, map_df: pd.DataFrame, sensor: str):
6363
"""
64-
Maps a DataFrame df, which contains data at the county resolution, and
65-
aggregate it to the geographic resolution geo_res.
64+
Map a DataFrame with county level data and aggregate it to the geographic resolution geo_res.
6665
6766
Parameters
6867
----------

usafacts/delphi_usafacts/pull.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414

1515

1616
def pull_usafacts_data(base_url: str, metric: str, geo_mapper: GeoMapper) -> pd.DataFrame:
17-
"""Pulls the latest USA Facts data, and conforms it into a dataset
17+
"""Pull the latest USA Facts data, and conform it into a dataset.
1818
1919
The output dataset has:
2020
@@ -53,7 +53,6 @@ def pull_usafacts_data(base_url: str, metric: str, geo_mapper: GeoMapper) -> pd.
5353
pd.DataFrame
5454
Dataframe as described above.
5555
"""
56-
5756
# Read data
5857
df = pd.read_csv(base_url.format(metric=metric)).rename({"countyFIPS":"FIPS"}, axis=1)
5958
# Check missing FIPS

usafacts/delphi_usafacts/smooth.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
1-
'''Functions for smoothing signals.'''
1+
"""Functions for smoothing signals."""
22
# -*- coding: utf-8 -*-
3+
"""Smoothing functions."""
34
import numpy as np
45

56
def identity(x):
6-
'''Trivial "smoother" that does no smoothing.
7+
"""Trivial "smoother" that does no smoothing.
78
89
Parameters
910
----------
@@ -14,11 +15,11 @@ def identity(x):
1415
-------
1516
np.ndarray:
1617
Same as x
17-
'''
18+
"""
1819
return x
1920

2021
def kday_moving_average(x, k):
21-
'''Compute k-day moving average on x.
22+
"""Compute k-day moving average on x.
2223
2324
Parameters
2425
----------
@@ -29,7 +30,7 @@ def kday_moving_average(x, k):
2930
-------
3031
np.ndarray:
3132
k-day moving average. The first k-1 entries are np.nan.
32-
'''
33+
"""
3334
if not isinstance(k, int):
3435
raise ValueError('k must be int.')
3536
# temp = np.append(np.zeros(k - 1), x)

0 commit comments

Comments
 (0)