brendan.mcdevitt.tech/_programming/2021-01-30-python-pandas-transform-csv.markdown
Brendan McDevitt e6c312a1ec big update
2022-02-25 01:56:24 -05:00

771 B

layout title date categories
programming python pandas: transform csv - add a new column 2021-01-30 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.


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.


{% include apple_advisories_cve_risk_scores.html %}