0

I have two data frames which consist of CVE vulnerability findings. I have scraped the vulnerability descriptions from a website and generated a second data frame with the results. Based on the Vulnerability column, I need to populate a new Description column in the first data frame.

It loops through multiple files and data frames, this is the current status of the function I'm trying to create to return a combined data frame (not in a working state).

def combineDfs(cve_list, desc_list, old_df):
    cve_descriptions = pd.DataFrame((zip(cve_list, desc_list)))
    result = {}
    for df in old_df:
        result = pd.concat([df, cve_descriptions], keys='Vulnerability')
    return result

I've tried the .groupby method and a few others, but I can't seem to get the new rows to align with the already existing rows versus tacking the new info below the existing rows.

Below shows an example of the contents of the first dataframe,

Vulnerability     Severity     Package
CVE-2021-34245    High         curl
CVE-2022-27090    Moderte      vim

The second data frame deduplicates the Vulnerability column and pulls the Description down for each CVE to create a second data frame that looks like the below,

Vulnerability     Description
CVE-2022-27090    Example description xyz.
CVE-2021-34245    Second example description.

The final dataframe should output the following,

Vulnerability     Severity     Package     Description
CVE-2021-34245    High         curl        Second example description.
CVE-2022-27090    Moderate     vim         Example description xyz.
Cat0ri
  • 1

0 Answers0