간격의 길이를 얻으려면 interval.length를 사용하세요. 특성. 먼저 필요한 라이브러리를 가져옵니다 -
import pandas as pd
값이 "nither"인 "closed" 매개변수를 사용하여 설정된 개방 간격. 열린 구간(수학에서 대괄호로 표시됨)은 끝점을 포함하지 않습니다. 즉, 열린 구간 [0, 5]는 0
interval = pd.Interval(5, 20, closed='neither')
간격 길이 표시
print("\nInterval length...\n",interval.length)
예
다음은 코드입니다.
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)
출력
그러면 다음 코드가 생성됩니다.
Interval... (5, 20) The left bound for the Interval... 5 The right bound for the Interval... 20 Interval length... 15