SEARCH
You are in browse mode. You must login to use MEMORY

   Log in to start


From course:

statistica/python

» Start this Course
(Practice similar questions for free)
Question:

Dato : heroes = pd.read_csv('data/heroes.csv', sep=';', index_col=0) heroes_with_year = heroes[heroes['First appearance'] < 2020] trasforma le frequenze da assolute a relative

Author: federico volpe

dato :
heroes = pd.read_csv('data/heroes.csv', sep=';', index_col=0)
heroes_with_year = heroes[heroes['First appearance'] < 2020]
trasforma le frequenze da assolute a relative



Answer:

Publisher_abs_freq = pd.crosstab(index=heroes_with_year['Publisher'], columns=['Rel. frequence'], colnames=['']) publisher_rel_freq = publisher_abs_freq / publisher_abs_freq.sum() publisher_rel_freq ---------------------------------------oppure:--------------------------------------- publisher_rel_freq = pd.crosstab(index=heroes_with_year['Publisher'], columns=['Rel. frequence'], colnames=[''], normalize=True) publisher_rel_freq


0 / 5  (0 ratings)

1 answer(s) in total