Writes judges' names in the ways that other sources may write them.
The FJC gives each judge's name in parts: first, middle, and last names and a suffix (such as "Jr." or "III"). Opinions, other datasets, and news write a judge's name in other ways, so the roster has a column for each way, which can be matched against them:
| Column | Example |
|---|---|
name_first_middle_last |
Robert Lanier Anderson |
name_first_middle_last_suffix |
Robert Lanier Anderson, III |
name_first_middle_initial_last |
Robert L. Anderson |
name_first_middle_initial_last_suffix |
Robert L. Anderson, III |
name_first_last |
Robert Anderson |
name_first_last_suffix |
Robert Anderson, III |
The FJC puts the letters of a name that a judge does not use in square brackets, as in "R[obert] Lanier Anderson III", who went by "R. Lanier Anderson". So each column above has the brackets removed ("Robert"), and a second column, whose name ends in "_bracket_period", has the brackets and the letters in them replaced with a period ("R."):
| Column | Example |
|---|---|
name_first_middle_last_bracket_period |
R. Lanier Anderson |
name_first_middle_last_suffix_bracket_period |
R. Lanier Anderson, III |
| ... | ... |
For a name without brackets, the two columns are the same. A part of a name that is missing is left out, so a judge without a middle name has "Mary Lynch" for both "name_first_middle_last" and "name_first_last", and a judge without a suffix has no comma.
Contents
add_permutations: adds a column for each way of writing judges' names. permutations: returns each way of writing a judge's name.
add_permutations(table)
¶
Adds a column for each way of writing judges' names.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
table
|
DataFrame
|
a table with the columns "first_name", "middle_name", "last_name", and "suffix" (such as a roster or the tidy table of the file of demographics). |
required |
Returns:
| Type | Description |
|---|---|
DataFrame
|
A new table with the columns of |
Raises:
| Type | Description |
|---|---|
KeyError
|
if |
Source code in src/fjc_biographies/names.py
columns()
¶
Returns the names of the columns that permutations makes.
Returns:
| Type | Description |
|---|---|
list[str]
|
The names, in order. |
Source code in src/fjc_biographies/names.py
permutations(first, middle, last, suffix=None)
¶
Returns each way of writing a judge's name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
first
|
Any
|
the first name, such as "R[obert]". |
required |
middle
|
Any
|
the middle name or names, such as "Lanier". It may be missing. |
required |
last
|
Any
|
the last name, such as "Anderson". |
required |
suffix
|
Any
|
the suffix, such as "III". Defaults to None. |
None
|
Returns:
| Type | Description |
|---|---|
dict[str, str | None]
|
Each way of writing the name, by the name of its column (see the module's documentation). All are None if the name has no first or last name. |