In python how do i find a difference in one column in conjun
In python, how do i find a difference in one column in conjunction with another? For example, there are two columns: zip code and campus-district. I want to find out how many different zip codes are used in the \"southern\" district? What code works best for this type of problem? this is a .csv file aka an excel spreadsheet format.
Solution
You can use Pandas.
According to your requirement i have written the code as below.
Code:
import pandas as pd
df = pd.DataFrame(data, columns=[\'zip\', \'campus_district\'])
df.groupby(\'zip\').mean().reset_index()
