---
layout: programming
title:  "python pandas: transform csv - add a new column"
date:  2021-01-30
categories: programming
---

# Problem:
I needed to group severity of CVEs for a project I am working on into low,
medium, and high ranges. We have a risk score value between 0-100 that we can use to
categorize each CVE into a range.

<br>

# Solution:
We use the pandas library because it has some methods already written that allow
us to read a csv file and apply our severity function to the data on each row
in our csv file.

We can use the apply() function to do this with a lambda. We can define a new
column this way and it will write out the newly computed data to its own column
at the end of our file.

<br>

{% include apple_advisories_cve_risk_scores.html %}
