Skip to content

Commit

Permalink
Merge pull request #155 from digital-land/add_severity
Browse files Browse the repository at this point in the history
Adding a null check
  • Loading branch information
ssadhu-sl authored Dec 4, 2023
2 parents e55f261 + b249384 commit a48cf31
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions digital_land/log.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,19 +64,20 @@ def add_severity_column(self, severity_mapping_path):
# Convert the existing log data to a DataFrame
log_df = pd.DataFrame(self.rows)

# Merge with severity_mapping based on 'issue-type'
merged_df = pd.merge(
log_df,
severity_mapping,
how="left",
left_on="issue-type",
right_on="issue-type",
)

# Add the new 'severity' column to the log data
self.fieldnames.append("severity")
self.fieldnames.append("description")
self.rows = merged_df.to_dict(orient="records")
if not log_df.empty:
# Merge with severity_mapping based on 'issue-type'
merged_df = pd.merge(
log_df,
severity_mapping,
how="left",
left_on="issue-type",
right_on="issue-type",
)

# Add the new 'severity' column to the log data
self.fieldnames.append("severity")
self.fieldnames.append("description")
self.rows = merged_df.to_dict(orient="records")


class ColumnFieldLog(Log):
Expand Down

0 comments on commit a48cf31

Please sign in to comment.