I have a data frame which consist of many cities and their corresponding temperature:
CurrentThermostatTemp
City
Cradley Heath 20.0
Cradley Heath 20.0
Cradley Heath 18.0
Cradley Heath 15.0
Cradley Heath 19.0
... ...
Walsall 16.0
Walsall 22.0
Walsall 20.0
Walsall 20.0
Walsall 20.0
[6249 rows x 1 columns]
The unique values are:
Index(['Cradley Heath', 'ROWLEY REGIS', 'Smethwick', 'Oldbury',
'West Bromwich', 'Bradford', 'Bournemouth', 'Poole', 'Wareham',
'Wimborne',
...
'St. Helens', 'Altrincham', 'Runcorn', 'Widnes', 'St Helens',
'Wakefield', 'Castleford', 'Pontefract', 'Walsall', 'Wednesbury'],
dtype='object', name='City', length=137)
My aim is to do the one-way ANOVA test i.e.
from scipy.stats import f_oneway
for all unique values in the data frame. So do
SciPy.stats.f_oneway("all unique values")
And receive the output: One-way ANOVA test for all variables gives {} with p-value {} This is what I have tried many times but does not work:
all = Tempvs.index.unique()
Tempvs.sort_index(inplace=True)
for n in range(len(all)):
truncated = Tempvs.truncate(all[n], all[n])
print(f_oneway(truncated))