-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge pull request #952 from CodeForPhilly/staging
Weekly PR from Staging to Main
Showing
9 changed files
with
143 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import pandas as pd | ||
from classes.featurelayer import FeatureLayer | ||
|
||
def owner_type(primary_featurelayer: FeatureLayer) -> FeatureLayer: | ||
""" | ||
Determines the ownership type for each property in the primary feature layer based on | ||
the 'owner_1', 'owner_2', and 'city_owner_agency' columns. The ownership type is set as: | ||
- "Public" if 'city_owner_agency' is not NA. | ||
- "Business (LLC)" if 'city_owner_agency' is NA and "LLC" is found in 'owner_1' or 'owner_2'. | ||
- "Individual" if 'city_owner_agency' is NA and "LLC" is not found in 'owner_1' or 'owner_2'. | ||
Args: | ||
primary_featurelayer (FeatureLayer): The feature layer containing property ownership data. | ||
Returns: | ||
FeatureLayer: The updated feature layer with the 'owner_type' column added. | ||
""" | ||
owner_types = [] | ||
|
||
for _, row in primary_featurelayer.gdf.iterrows(): | ||
# Extract owner1, owner2, and city_owner_agency | ||
owner1 = str(row["owner_1"]).lower() | ||
owner2 = str(row["owner_2"]).lower() | ||
city_owner_agency = row["city_owner_agency"] | ||
|
||
# Determine ownership type based on the conditions | ||
if pd.notna(city_owner_agency): | ||
owner_types.append("Public") | ||
elif " llc" in owner1 or " llc" in owner2: | ||
owner_types.append("Business (LLC)") | ||
else: | ||
owner_types.append("Individual") | ||
|
||
# Add the 'owner_type' column to the GeoDataFrame | ||
primary_featurelayer.gdf["owner_type"] = owner_types | ||
|
||
return primary_featurelayer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters