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
  format json outputs ! evilcode1 3 1,691 Oct-29-2023, 01:30 PM
Last Post: omemoe277
  Formatting outputs created with .join command klairel 2 592 Aug-23-2023, 08:52 AM
Last Post: perfringo
  I have written a program that outputs data based on GPS signal kalle 1 1,126 Jul-22-2022, 12:10 AM
Last Post: mcmxl22
  Why does absence of print command outputs quotes in function? Mark17 2 1,340 Jan-04-2022, 07:08 PM
Last Post: ndc85430
  Thoughts on interfacing with a QR code reader that outputs keystrokes? wrybread 1 1,447 Oct-08-2021, 03:44 PM
Last Post: bowlofred
  ONE input => THREE outputs Tricia279 6 2,559 Jan-14-2021, 08:52 AM
Last Post: perfringo
  Multi set string inputs/outputs kwmcgreal 2 2,007 Sep-26-2020, 10:44 PM
Last Post: kwmcgreal
  How to use subprocess to get multiple data outputs in desired folder? 3SG14 1 2,161 Sep-19-2020, 05:46 PM
Last Post: bowlofred
  Outputs missing SamAnw 4 2,537 Feb-12-2020, 04:32 PM
Last Post: adetheheat
  Interpreter and running a .py file give different outputs PythonNPC 5 2,946 Jul-21-2019, 01:07 PM
Last Post: PythonNPC

Forum Jump:

User Panel Messages

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