Returning multiple values from pandas apply on a DataFrame
I'm using a Pandas DataFrame to do a row-wise t-test as per this example:

    import numpy
    import pandas
  
    df = pandas.DataFrame(numpy.log2(numpy.randn(1000, 4), 
                          columns=["a", "b", "c", "d"])

    df = df.dropna()

Now, supposing I have "a" and "b" as one group, and "c" and "d" at the other, I'm performing the t-test row-wise. This is fairly trivial with pandas, using `apply` with axis=1. However, I can either return a DataFrame of the same shape if my function doesn't aggregate, or a Series if it aggregates.

Normally I would just output the p-value (so, aggregation) but I would like to generate an additional value based on other calculations (in other words, return two values). I can of course do two runs, aggregating the p-values first, then doing the other work, but I was wondering if there is a more efficient way to do so as the data is reasonably large.

My expected output would be a DataFrame with two columns, one for the first result, and one for the second.

Is this possible or I have to do two runs for the two calculations, then merge them together?
Returning multiple values from pandas apply on a DataFrame
===

I'm using a Pandas DataFrame to do a row-wise t-test as per this example:

    import numpy
    import pandas
  
    df = pandas.DataFrame(numpy.log2(numpy.randn(1000, 4), 
                          columns=["a", "b", "c", "d"])

    df = df.dropna()

Now, supposing I have "a" and "b" as one group, and "c" and "d" at the other, I'm performing the t-test row-wise. This is fairly trivial with pandas, using `apply` with axis=1. However, I can either return a DataFrame of the same shape if my function doesn't aggregate, or a Series if it aggregates.

Normally I would just output the p-value (so, aggregation) but I would like to generate an additional value based on other calculations (in other words, return two values). I can of course do two runs, aggregating the p-values first, then doing the other work, but I was wondering if there is a more efficient way to do so as the data is reasonably large.

My expected output would be a DataFrame with two columns, one for the first result, and one for the second.

Is this possible or I have to do two runs for the two calculations, then merge them together?