Skip to content

Tag: pandas

T-test in Pandas

If I want to calculate the mean of two categories in Pandas, I can do it like this: I have a lot of data formatted this way, and now I need to do a T-test to see if the mean of cat1 and cat2 are statistically different. How can I do that? Answer it depends what sort of t-test you

pandas pivot dataframe to 3d data

There seem to be a lot of possibilities to pivot flat table data into a 3d array but I’m somehow not finding one that works: Suppose I have some data with columns=[‘name’, ‘type’, ‘date’, ‘value’]. When I try to pivot via I get Am I reading docs from dev pandas maybe? It seems like this is the usage described there.

pandas: filter rows of DataFrame with operator chaining

Most operations in pandas can be accomplished with operator chaining (groupby, aggregate, apply, etc), but the only way I’ve found to filter rows is via normal bracket indexing This is unappealing as it requires I assign df to a variable before being able to filter on its values. Is there something more like the following? Answer I’m not entirely sure