'how to prase() list of user agent in Python

I have a CSV list of rows of user agent data and I want to implement user_agent library funcs. in the CSV data, I have several columns but want to use only 'user_agent' column.

I cant manage to parse the list:

import pandas as pd
data = pd.read_csv(r'.\useragents_210210_anonymized.csv')
df = pd.DataFrame(data)
from user_agents import parse;

df['user_agent'] = df['user_agent'].astype("string");

for i in df['user_agent']:
    
    user_agent = parse(df['user_agent'][i]); 

The error that I get is the first string of the first row of the data.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source