Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7162579
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T13:45:32+00:00 2026-05-28T13:45:32+00:00

i apologize in advance for not being very precise, as a i dont know

  • 0

i apologize in advance for not being very precise, as a i dont know the mathematical expression for what i want.

i am using matplotlib to analyze a large dataset. What i have now is a distribution of x,y points. I want to find out the cases in which the x values of my function are the same, but y differs the greatest. So if i plot it, one part of the cases is at the top of my graph, the other is the botton of the graph.

So how do i get the points(x,y), (x,y’) where f(x)=y and f(x)=y’ and y-y’=max ?

cheers

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T13:45:32+00:00Added an answer on May 28, 2026 at 1:45 pm

    Not sure if I understand correctly but here is a raw solution which you could adapt:

    from collections import defaultdict
    
    input = [(1.2,2), (1.2, 6), (1.2, -2), (2,8), (2,7), (2,18)]
    
    indices_dict = defaultdict(lambda: list([[], []]))
    
    for idx, val in enumerate(input):
        indices_dict[val[0]][0].append(idx)
        indices_dict[val[0]][1].append(val[1])
    
    for key in indices_dict:
        y_values = indices_dict[key][1]
        idx_values =  indices_dict[key][0]
        max_idx = idx_values[y_values.index(max(y_values))]
        min_idx = idx_values[y_values.index(min(y_values))]
        print 'Max diff for x=%s is found between points %s and %s' %(key, input[min_idx], input[max_idx])
    

    This should print for each distinct x the points which have the max difference on y. You can adapt it to your requirements.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I apologize in advance if my question is not clear, because I don't know
I apologize for being a bit verbose in advance: if you want to skip
I'd like to apologize in advance, because this is not a very good question.
I apologize in advance for being too vague, if you need any precision I
I apologize in advance if the terminology in my question is incorrect. I want
this is likely to endup being an easy fix so I'll apologize in advance
I apologize in advance for not even knowing how to correctly phrase what I
I apologize in advance for asking this question, I know similar questions have already
I apologize in advance if this has been addressed, but I have not found
Apologies in advance for the possible flame thread, but that's not what I'm going

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.