pycall.rb icon indicating copy to clipboard operation
pycall.rb copied to clipboard

Lack of the way to check object identity

Open mrkn opened this issue 4 years ago • 0 comments

In Python, we can check object identity by x is y expression. PyCall should provide a way to do it.

>> idx = Pandas::Index.new([*0...3])
>> idx
=> Int64Index([0, 1, 2], dtype='int64')
>> s = Pandas::Series.new([2.71, 3.14, 42.0], index: idx)
>> s.index.
>> s.index.equal?(idx)
=> false
>> PyCall.eval("lambda x, y: x is y").(idx, s.index)
=> true

mrkn avatar Apr 22 '20 02:04 mrkn