-1

I tried to apply shapely, But even after reading the documentation, I wasn't really successful.

I tried for another answer.

Area inside a closed loop curve in python

My implementation was like this.

from shapely.geometry import Point
i = Point(test.Distance.iloc[0],test.Resistance.iloc[0]).buffer(15)
j = Point(mean.Distance.iloc[-1],mean.Resistance.iloc[-1]).buffer(15)
k = i.intersection(j)
k.area

The plot is of discreate data points.

It's not a closed loop, but as you can see I tried to just extend a straight line to connect it back so that it's a closed shape but yet unsuccessful to compute the area.

Thank you in advance

Irregular shape plot

Edit: I solved it.

Just form a polygon using shapely and find the area.

p = Polygon(zip(test.Distance,test.Resistance))
p.area
get2anc
  • 41
  • 6
  • This question needs a [SSCCE](http://sscce.org/). Please see [How to ask a good question](https://stackoverflow.com/help/how-to-ask). Always provide a complete [mre] with **code, data, errors, current output, and expected output**, as **[formatted text](https://stackoverflow.com/help/formatting)**. If relevant, only plot images are okay. If you don't include an mre, it is likely the question will be downvoted, closed, and deleted. – Trenton McKinney Nov 07 '21 at 14:01

1 Answers1

0

I just solved the problem:

Just form a polygon using shapely and find the area.

Shapely polygon function uses coordinates so I have used zip function:

from shapely.geometry import Polygon
p = Polygon(zip(test.Distance,test.Resistance))
p.area

get2anc
  • 41
  • 6