Skip to content

Commit cfdfa47

Browse files
chekosclaude
andcommitted
Fix review issues: len() commas, math errors, 2020 ACS skip
- Remove comma formatting from len() output blocks (len() returns plain ints, not comma-separated) - Fix moe_sum output: 2746.0 → 2746.4 (sqrt(1500² + 2300²)) - Fix moe_ratio output: 0.063 → 0.065 (correct formula application) - Fix multi-year.md inflation example to skip 2020 ACS 1-year (not released due to COVID-19) - Fix DATE_DESC values in multi-year.md to match population-estimates.md - Fix housing WGTP column count: 80 → 81 (WGTP + WGTP1–WGTP80) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ccd35b9 commit cfdfa47

9 files changed

Lines changed: 31 additions & 32 deletions

File tree

docs/getting-started/census-101.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ print(f"{len(la_tracts)} tracts in Los Angeles County")
226226
```
227227

228228
```
229-
2,495 tracts in Los Angeles County
229+
2495 tracts in Los Angeles County
230230
```
231231

232232
---

docs/guides/acs-data.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ print(f"{len(la_tracts)} tracts in LA County")
234234
```
235235

236236
```
237-
2,495 tracts in LA County
237+
2495 tracts in LA County
238238
```
239239

240240
!!! tip "County FIPS codes"
@@ -257,7 +257,7 @@ print(f"{len(cook_bgs)} block groups in Cook County")
257257
```
258258

259259
```
260-
4,010 block groups in Cook County
260+
4010 block groups in Cook County
261261
```
262262

263263
**All places in a state:**
@@ -274,7 +274,7 @@ print(tx_places.head(3))
274274
```
275275

276276
```
277-
1,834 places in Texas
277+
1834 places in Texas
278278
GEOID NAME variable estimate moe
279279
0 4800100 Abernathy city, Texas B01003_001 2846 229.0
280280
1 4800484 Addison town, Texas B01003_001 16661 1031.0
@@ -684,7 +684,7 @@ print(f"Statistically significant: {is_sig}")
684684
```
685685

686686
```
687-
Combined MOE: 2746.0
687+
Combined MOE: 2746.4
688688
Proportion MOE: 0.0305
689689
Statistically significant: True
690690
```

docs/guides/geography.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ optionally which county) you want tracts for.
133133
```
134134
52 states/territories
135135
939 metro/micro areas
136-
33,120 ZCTAs
136+
33120 ZCTAs
137137
```
138138

139139
=== "State required"
@@ -160,7 +160,7 @@ optionally which county) you want tracts for.
160160

161161
```
162162
58 counties in CA
163-
1,834 places in TX
163+
1834 places in TX
164164
```
165165

166166
=== "State + county required"
@@ -188,8 +188,8 @@ optionally which county) you want tracts for.
188188
```
189189

190190
```
191-
2,495 tracts in LA County
192-
4,010 block groups in Cook County
191+
2495 tracts in LA County
192+
4010 block groups in Cook County
193193
```
194194

195195
## FIPS codes explained

docs/guides/margins-of-error.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -308,7 +308,7 @@ print(f"Renter-to-owner ratio: {ratio_est:.3f} +/- {ratio_moe:.3f}")
308308
```
309309

310310
```
311-
Renter-to-owner ratio: 0.429 +/- 0.063
311+
Renter-to-owner ratio: 0.429 +/- 0.065
312312
```
313313

314314
### `moe_prop()` --- margins of error for proportions

docs/guides/migration-flows.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ print(f"{len(age_flows)} flow records with age breakdowns")
141141
```
142142

143143
```
144-
45,210 flow records with age breakdowns
144+
45210 flow records with age breakdowns
145145
```
146146

147147
### Adding human-readable labels

docs/guides/multi-year.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ critical for multi-year analysis.
227227
```
228228

229229
```
230-
2,495 tracts in Los Angeles County
230+
2495 tracts in Los Angeles County
231231
```
232232

233233
### Year interpretation for ACS 5-year
@@ -358,14 +358,13 @@ import pypums
358358
cpi = {
359359
2018: 251.1,
360360
2019: 255.7,
361-
2020: 258.8,
362361
2021: 270.9,
363362
2022: 292.7,
364363
}
365364
target_year = 2022
366365

367366
frames = []
368-
for year in range(2018, 2023):
367+
for year in [2018, 2019, 2021, 2022]: # skip 2020 (no standard ACS 1-year)
369368
df = pypums.get_acs(
370369
geography="state",
371370
variables="B19013_001", # Median household income
@@ -387,9 +386,8 @@ print(trend[["year", "estimate", "estimate_real"]])
387386
year estimate estimate_real
388387
0 2018 75277.0 87760.6
389388
1 2019 78672.0 90046.7
390-
2 2020 78672.0 89005.4
391-
3 2021 80440.0 86906.3
392-
4 2022 84097.0 84097.0
389+
2 2021 80440.0 86906.3
390+
3 2022 84097.0 84097.0
393391
```
394392

395393
!!! note
@@ -420,12 +418,12 @@ print(df[["NAME", "DATE_CODE", "DATE_DESC", "value"]].head(10))
420418
```
421419

422420
```
423-
NAME DATE_CODE DATE_DESC value
424-
0 California 1 4/1/2020 Census pop. 39538223
425-
1 California 2 7/1/2020 pop. est. 39499738
426-
2 California 3 7/1/2021 pop. est. 39142991
427-
3 California 4 7/1/2022 pop. est. 38965193
428-
4 California 5 7/1/2023 pop. est. 38965193
421+
NAME DATE_CODE DATE_DESC value
422+
0 California 1 4/1/2020 Census population 39538223
423+
1 California 2 7/1/2020 population estimate 39499738
424+
2 California 3 7/1/2021 population estimate 39142991
425+
3 California 4 7/1/2022 population estimate 38965193
426+
4 California 5 7/1/2023 population estimate 38965193
429427
```
430428

431429
This is more efficient than looping over individual years and avoids the need

docs/guides/population-estimates.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ print(f"{len(by_age_sex)} rows (states × age groups × sexes)")
174174
```
175175

176176
```
177-
4,992 rows (states × age groups × sexes)
177+
4992 rows (states × age groups × sexes)
178178
```
179179

180180
---
@@ -672,7 +672,7 @@ print(race_data[["NAME", "RACE_label", "HISP_label", "value"]].head(4))
672672
```
673673

674674
```
675-
7,620 rows
675+
7620 rows
676676
NAME RACE_label HISP_label value
677677
0 Anderson County, Texas All races Both Hispanic Origins 57245
678678
1 Anderson County, Texas All races Non-Hispanic 43210

docs/guides/pums-microdata.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ print(females[["AGEP", "SEX", "SCHL"]].head())
117117
```
118118

119119
```
120-
198,412 records (all SEX == 2)
120+
198412 records (all SEX == 2)
121121
AGEP SEX SCHL
122122
0 35 2 21
123123
1 33 2 16
@@ -140,7 +140,7 @@ print(f"{len(grad_degrees)} records with Bachelor's, Master's, or Doctorate")
140140
```
141141

142142
```
143-
98,245 records with Bachelor's, Master's, or Doctorate
143+
98245 records with Bachelor's, Master's, or Doctorate
144144
```
145145

146146
!!! tip "Server-side vs. client-side filtering"
@@ -168,7 +168,7 @@ print(employed_male_ba[["AGEP", "SEX", "SCHL", "ESR", "WAGP"]].head())
168168
```
169169

170170
```
171-
12,843 employed males with BA in New York
171+
12843 employed males with BA in New York
172172
AGEP SEX SCHL ESR WAGP
173173
0 34 1 21 1 65000
174174
1 28 1 21 1 52000
@@ -264,10 +264,11 @@ are included.
264264
```
265265

266266
```
267-
80 WGTP columns: ['WGTP1', 'WGTP2', 'WGTP3', 'WGTP4'] ... ['WGTP79', 'WGTP80']
267+
81 WGTP columns: ['WGTP', 'WGTP1', 'WGTP2', 'WGTP3'] ... ['WGTP79', 'WGTP80']
268268
```
269269

270-
Adds 80 housing replicate weight columns (`WGTP1` through `WGTP80`).
270+
Adds 80 housing replicate weight columns (`WGTP1` through `WGTP80`)
271+
alongside the main weight `WGTP`.
271272

272273
=== "Both"
273274

@@ -347,7 +348,7 @@ print(f"{len(dtla)} records in PUMA 03710 (Downtown LA)")
347348
```
348349

349350
```
350-
2,841 records in PUMA 03710 (Downtown LA)
351+
2841 records in PUMA 03710 (Downtown LA)
351352
```
352353

353354
### Multiple PUMAs

docs/migration/from-tidycensus.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ If you've used Kyle Walker's [tidycensus](https://walker-data.com/tidycensus/) R
140140
```
141141

142142
```
143-
2,495 tracts
143+
2495 tracts
144144
GEOID NAME estimate geometry
145145
0 06037101110 Census Tract 1011.10, ... 85714.0 POLYGON ((-118.24 34.05...
146146
1 06037101122 Census Tract 1011.22, ... 62500.0 POLYGON ((-118.25 34.04...

0 commit comments

Comments
 (0)