[Tutor] Is there an straightforward way to tell if a dataframe is a convex set ?

ThreeBlindQuarks threesomequarks at proton.me
Tue Apr 4 20:35:40 EDT 2023


What kind of answer do you want Marc Nicole?

Do you want to know if a function exists in some module? Someone may know.

Do you want to know how to solve any specific part of the problem in python using common methods? The best way is to come up with a recipe in pseudocode that implements what you think needs to be done. Then you may see a solution or want to ask a very specific question about a part as this is for tutoring rather than supplying free programming.

As I see it, convexity in this concept may not be about a Dataframe as much as a set. It is a condition that all values of the set will have some other values in the set based on a condition. Is this web page about right? Did you post it or someone else in a class with you?

https://stackoverflow.com/questions/75920490/check-if-a-dataframe-is-a-convex-set

You would need to explain if this relates to a Dataframe as in does it have to have two columns with a row for each required pairing with the first number in column one and a pairing in column two?

As noted there, using all values between 0 and 1 makes no sense for a finite Dataframe.

Now if your question is simpler and about whether all columns of the dataframe can be combined and made into one combined set, then that set can be tested fairly easily by iterating over all elements and calculating for each what else must be in the set and testing if they are present. If any one is missing, exit your loop with a status saying it is not a convex set and so on.

You may need to explain more or wait for others who know more and can make a better guess what you want.

If you really need to work with a Dataframe and entries in columns, there can be other advice on how to use something, like perhaps a dictionary, or do some brute force searches in numpy/pandas. 

The easiest questions to answer are the most specific. You mentioned a scipy function which makes a convex hull, not checks if you already have one.

- Q








Sent with Proton Mail secure email.

------- Original Message -------
On Tuesday, April 4th, 2023 at 4:45 PM, marc nicole <mk1853387 at gmail.com> wrote:


> Hello,
> 
> Is there a way to tell if a dataframe is convex (in the convex set theory
> sense)(e.g.,scipy.spatial)?
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor


More information about the Tutor mailing list