How to transform a dataset's mean and standard deviation with different values per column in R
By : Alex
Date : March 29 2020, 07:55 AM

Calculate standard deviation of same text values between cells in same column
By : savaryl
Date : March 29 2020, 07:55 AM
seems to work fine I will show you what I mean by a Table with structured references. I copied your data for the text and value columns. I also added the header: Result to cell C1. I then selected the Table option from the Insert ribbon (on the Tables tab) code :
=STDEVP(IF(Table1[[#This Row],[text]]=[text],[value],""))

Calculate standard deviation of same text values in same column
By : user3726076
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further Here is a formula and VBA route that gives you the STDEV.S for each set of items. Picture shows the various ranges and results. My input is the same as yours, but I accidentally sorted it at one point so they don't line up. code :
=STDEV.S(IF(B3=$B$3:$B$21,$C$3:$C$21))
Public Function STDEV_S_IF(rng_criteria As Range, rng_criterion As Range, rng_values As Range) As Variant
Dim str_frm As String
'formula to reproduce
'=STDEV.S(IF(B3=$B$3:$B$21,$C$3:$C$21))
str_frm = "STDEV.S(IF(" & _
rng_criterion.Address & "=" & _
rng_criteria.Address & "," & _
rng_values.Address & "))"
'if you have more than one sheet, be sure it evalutes in the right context
'or add the sheet name to the references above
'single sheet works fine with just Application.Evaluate
'STDEV_S_IF = Application.Evaluate(str_frm)
STDEV_S_IF = Sheets("Sheet2").Evaluate(str_frm)
End Function
=STDEV_S_IF($B$3:$B$21,B3,$C$3:$C$21)
Sub test()
Debug.Print STDEV_S_IF(Range("B3:B21"), Range("B3"), Range("C3:C21"))
'correctly returns 206.301357242263
End Sub

How can I get the standard deviation for a set of rows in my dataframe based on a condition in one column?
By : ndkSimplice
Date : March 29 2020, 07:55 AM
With these it helps I have a dataframe of , Another way, using base R... code :
df$lat_sd < ave(df$lat, df$year, FUN=sd)

pandas returning the values from a column with zero standard deviation of another column transaction
By : user3366234
Date : March 29 2020, 07:55 AM
Hope this helps When you groupby and do std directly, the result is only the size of the unique customerid(since that's the groupby metric) and loc gives the error. What you need is transform function which does it for each corresponding row. code :
df1= df.loc[(df['units'].groupby(df['customerid']).transform('std')==0)]
df['TimeDiff'] = df.groupby('customerid')['tstamp'].transform(lambda g: (g.max()g.min()).seconds)
df2 = df[df['TimeDiff']<600]
df3 = pd.concat([df1,df2]).drop_duplicates()

