यह जांचने के लिए कि क्या अंतराल बाईं ओर खुला है, interval.open_left . का उपयोग करें संपत्ति। सबसे पहले, आवश्यक पुस्तकालयों को आयात करें -
import pandas as pd
"न तो" मान के साथ "बंद" पैरामीटर का उपयोग करके खुला अंतराल सेट करें। एक खुला अंतराल (गणित में वर्ग कोष्ठक द्वारा दर्शाया गया है) में इसके समापन बिंदु नहीं होते हैं, अर्थात खुला अंतराल [0, 5] शर्तों की विशेषता है 0
interval = pd.Interval(5, 20, closed='neither')
अंतराल प्रदर्शित करें
print("Interval...\n",interval)
जांचें कि क्या अंतराल बाईं ओर खुला है
print("\nCheck if the interval is open on the left side...\n",interval.open_left)
उदाहरण
निम्नलिखित कोड है
import pandas as pd # Open interval set using the "closed" parameter with value "neither" # An open interval (in mathematics denoted by square brackets) does not contains its endpoints, # i.e. the open interval [0, 5] is characterized by the conditions 0 < x < 5. interval = pd.Interval(5, 20, closed='neither') # display the interval print("Interval...\n",interval) # the left bound print("\nThe left bound for the Interval...\n",interval.left) # the right bound print("\nThe right bound for the Interval...\n",interval.right) # display the interval length print("\nInterval length...\n",interval.length) # check whether the interval is open on the left side print("\nCheck if the interval is open on the left side...\n",interval.open_left)
आउटपुट
यह निम्नलिखित कोड उत्पन्न करेगा
Interval... (5, 20) The left bound for the Interval... 5 The right bound for the Interval... 20 Interval length... 15 Check if the interval is open on the left side... True