pycall.rb
pycall.rb copied to clipboard
Lack of the way to check object identity
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