Parsing Scraped Data with Pandas

Once you have some data you’ll need to find the relevant parts and use them for further analysis. Rather than use the proverbial Excel sheet you can write code to automate the task.

Consider the following :

import pandas as pd
df=pd.read_csv('SalesRecords.csv')

The following code will match where the row contains “Djibouti” and

return the value that is in the column “Order Priority provided you add “iloc[0]” or whatever index number you require.

df.loc[df['Country']=='Djibouti',['Order Priority']]

head shows the first 5 rows, but df.loc finds “Dijbouti” on lines 34,59 and 73, along with their order priority as requested in the [ square brackets ]