I am getting an error saying "ValueError: Can only compare identically-labeled Series objects". I got as far as knowing that I am comparing two series objects and not the values inside them. However, I thought series[column]
gave you the value inside. Can someone elaborate more on this? I am truly stuck on where i could find this information and would gradly love to be pointed toward the right direction. all_ages
and recent_grads
are dataframes.
import pandas as pd
majors = recent_grads['Major'].unique()
rg_lower_count = 0
for x in majors:
aa_major = all_ages[all_ages['Major'] == x]
rg_major = recent_grads[recent_grads["Major"] == x]
if rg_major["Unemployment_rate"] < aa_major["Unemployment_rate"]:
rg_lower_count += 1
print(rg_lower_count)