Advertisement
elena1234

table transformation before ANOVA

Jul 20th, 2022 (edited)
733
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. data_new = pd.melt(data.reset_index(), id_vars=['index'], value_vars=['A','B','C'])
  2. data_new.columns=['index','treatments','value']
  3.  
  4. Two-Way ANOVA
  5. # you do not need to reshape if your data is already in stacked format.
  6. d_melt = pd.melt(data, id_vars=['Genotype'], value_vars=['1_year', '2_year', '3_year'])
  7. # replace column names
  8. d_melt.columns = ['Genotype', 'years', 'value']
  9. d_melt.head()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement