Adds Judicial Common Space scores of judges, justices, and courts.
The Judicial Common Space (Epstein, Martin, Segal, and Westerland, "The Judicial Common Space," 23 J.L. Econ. & Org. 303 (2007)) places judges, justices of the Supreme Court, members of Congress, and presidents on one scale of ideology, on which higher scores are more conservative. The judicial-common-space package (https://github.com/WithPrecedent/judicial_common_space) computes the scores and downloads the files that they are computed from and checked against, which courtpy uses in three ways:
- Each appointment of a judge or justice has a score, which fjc-biographies
adds to a roster with judicial-common-space
(
courtpy.judges.Roster.from_fjc(jcs = True)) as "jcs", an attribute of each judge like "party":code_panelsadds "panel_jcs" (the mean score of each case's panel), andadd_biographyadds "judge_jcs". Unlike the published scores, which are of the judges of the courts of appeals and the justices, the computed scores are of district judges too. - Each justice has a score in each term, which
courtpy.politics.justicesreturns with the justice's Martin-Quinn score, so the scores can be added to the Supreme Court Database's votes (seecourtpy.scdb.votes). - Each year has the scores of the president and of the medians of the House,
the Senate, the Supreme Court, and each court of appeals, which its authors
publish at https://epstein.wustl.edu/jcs.
mediansreads them, so they can be added to cases by "year" with themerge_keystechnique ofamos(or be a part ofcourtpy.politics.build_table).
The published files are downloaded by judicial-common-space (see download)
into "jcs" in courtpy.utilities.data_folder(), where it looks for them too:
| Kind | File | Rows |
|---|---|---|
judges |
"judges.csv" | Each judge of a court of appeals, with the judge's name, circuit, and score. |
justices |
"justices.csv" | Each justice in each term of the Supreme Court. |
medians |
"medians.csv" | Each year, with the scores of the president and of the medians of the House, the Senate, the Supreme Court, and each court of appeals. |
import courtpy
roster = courtpy.judges.Roster.from_fjc(jcs = True)
roster.save()
table = courtpy.politics.build_table(common_space = True)
download_jcs (a reference loader, see courtpy.loaders.ReferenceLoader)
downloads the files and loads one of them, so a study can start from the
scores themselves.
Contents
DownloadJcs: downloads the published files of Judicial Common Space scores and loads one of them. download: downloads the published files of Judicial Common Space scores. medians: returns the scores of the president and of the medians of Congress and the courts in each year.
DownloadJcs(contents=None, name='', parameters=dict(), clerk=None)
dataclass
¶
Bases: ReferenceLoader
Downloads the published files of Judicial Common Space scores.
The archive of the scores is downloaded unless its files are there
already, or "refresh" is true (see download), and the file named by
"kind" is loaded: "medians" (the default, a row for each year, as
medians returns it), "judges" (a row for each judge of a court of
appeals), or "justices" (a row for each justice in each term). Its
"source" is the data folder whose "jcs" folder keeps the files, which is
courtpy.utilities.data_folder() unless another is set.
load(source, *, kind='medians', refresh=False, session=None, **kwargs)
¶
Downloads the files and returns the table of one of them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
Any
|
the data folder, or "current" for
|
required |
kind
|
str
|
the file to load: "medians", "judges", or "justices". Defaults to "medians". |
'medians'
|
refresh
|
bool | str
|
whether to download the archive even if the files are
there. Defaults to |
False
|
session
|
Any
|
an object with a |
None
|
**kwargs
|
Any
|
not used. |
{}
|
Raises:
| Type | Description |
|---|---|
ValueError
|
if |
Returns:
| Type | Description |
|---|---|
DataFrame
|
The table. |
Source code in src/courtpy/references/jcs.py
download(folder=None, *, kinds=None, overwrite=False, session=None)
¶
Downloads the published files of Judicial Common Space scores.
The scores are posted as one archive (about 100 kilobytes), which
judicial_common_space.sources.download finds by its link on
https://epstein.wustl.edu/jcs and unpacks. Its CSV files are saved as
"judges.csv", "justices.csv", and "medians.csv" (see the module's
documentation), and the archive is kept beside them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
folder
|
Path | str | None
|
the data folder, whose "jcs" folder they are saved in.
Defaults to |
None
|
kinds
|
Sequence[str] | str | None
|
the files to return: any of "judges", "justices", and
"medians". Defaults to |
None
|
overwrite
|
bool
|
whether to download the archive even if the files are
there. The scores are updated every few years. Defaults to
|
False
|
session
|
Any
|
an object with a |
None
|
Raises:
| Type | Description |
|---|---|
HTTPError
|
if the page or the archive cannot be downloaded. |
ValueError
|
if one of |
Returns:
| Type | Description |
|---|---|
dict[str, Path]
|
The path of each file, by its kind. |
Source code in src/courtpy/references/jcs.py
medians(source=None)
¶
Returns the scores of the president and of medians in each year.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source
|
DataFrame | Path | str | None
|
the file of medians (see |
None
|
Raises:
| Type | Description |
|---|---|
KeyError
|
if |
Returns:
| Type | Description |
|---|---|
DataFrame
|
A table with "year" and, for each of these that the file has, "jcs_president" (the president's score), "jcs_house_median", "jcs_senate_median", "jcs_supreme_court_median", and "jcs_circuit{n}_median" and "jcs_circuit{n}_sd" (the median and standard deviation of the scores of each court of appeals, numbered as the federal rules number them, with 12 for the District of Columbia and 13 for the Federal Circuit). A year with more than one row in the file (as when a new president or Congress took office) has their means. |