Python Forum
Combining outputs into a dataframe
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Combining outputs into a dataframe
#1
Hi,

I'm hoping for some help with combining several results into a dataframe.

There are 12 queries with results like this in total, but for this I will only use the top 2 which I have simplified here. (I've used font colours just to try and make the question clearer).

Effectively I'm just performing mannwhitney-u tests and combining the results together to see along side each other.

The first query/result looks like:
# significance test on matching period for product group value
sample = matched_outlet_data_sample[matched_outlet_data_sample['is_matching_period'] == 1]
control = matched_outlet_data_control[matched_outlet_data_control['is_matching_period'] == 1]
mannwhitneyu(sample['product_volume'], control['product_volume'])


which outputs:

MannwhitneyuResult(statistic=2512124.0, pvalue=1.171173665936018e-16)

the second query/result looks like:

# significance test on matching period for product group volume
sample = matched_outlet_data_sample[matched_outlet_data_sample['is_matching_period'] == 1]
control = matched_outlet_data_control[matched_outlet_data_control['is_matching_period'] == 1]
mannwhitneyu(sample['product_volume'], control['product_volume'])


which outputs:

MannwhitneyuResult(statistic=2217863.5, pvalue=1.3144757236956563e-46)

And the dataframe I would like to achieve from this would look something like:
(I don't know how to show tables here so i've just added commas as seperators)

result, statistic, pvalue
significance_test_on_matching_period_for_product_group_value, 2512124.0, 1.171173665936018e-16
significance_test_on_matching_period_for_product_group_volume, 2217863.5, 1.3144757236956563e-46


I don't know to do this, so any help would be really good. I suppose it would require creating a dataframe with one row, and then just adding a row to it with each result until all 12 results are in the dataframe?

I know that this isn't the clearest presentation of the problem, so if anything isn't clear please do let me know.

And thanks all, I really appreciate any help with this a new python user.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  ONE input => THREE outputs Tricia279 6 487 Jan-14-2021, 08:52 AM
Last Post: perfringo
  Multi set string inputs/outputs kwmcgreal 2 525 Sep-26-2020, 10:44 PM
Last Post: kwmcgreal
  How to use subprocess to get multiple data outputs in desired folder? 3SG14 1 567 Sep-19-2020, 05:46 PM
Last Post: bowlofred
  Outputs missing SamAnw 4 738 Feb-12-2020, 04:32 PM
Last Post: adetheheat
  Interpreter and running a .py file give different outputs PythonNPC 5 1,048 Jul-21-2019, 01:07 PM
Last Post: PythonNPC
  Save outputs to Desktop cisicomania 1 1,216 Aug-31-2018, 10:08 AM
Last Post: Gribouillis
  Help Editing/Problem with outputs stanthaman42 7 1,985 Jul-11-2018, 05:30 PM
Last Post: ichabod801
  how do i rewrite this code to give me 10 outputs BlackPimpernel 2 1,277 Mar-29-2018, 11:29 AM
Last Post: BlackPimpernel
  Different outputs in Python2 and Python3 MikeHill 3 2,321 Jun-07-2017, 08:58 PM
Last Post: Ofnuts
  Program that outputs HQ addresses of companies from Google + Local pages frenchgirl1309 2 2,649 Nov-14-2016, 10:11 PM
Last Post: Ofnuts

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020