sociofillmore_public / sociofillmore /migration /extract_political_ratings.py
Gosse Minnema
Add sociofillmore code, load dataset via private dataset repo
b11ac48
raw
history blame contribute delete
631 Bytes
import pandas as pd
def main():
corpus_df = pd.read_excel("data/migration/corpus_titoli_2013_2021_with_most_recent_years.xlsx")
ratings = corpus_df.groupby("Testata").first()[["Orientamento politico", "Religiosa?"]]
ratings.index.rename("provider", inplace=True)
ratings["political_stance"] = ratings["Orientamento politico"]
ratings["religious"] = ratings["Religiosa?"] == "religiosa"
ratings.drop("Orientamento politico", axis=1, inplace=True)
ratings.drop("Religiosa?", axis=1, inplace=True)
ratings.to_csv("data/migration/provider_pol_rel_ratings.csv")
if __name__ == "__main__":
main()