question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Some arithmetic operators for IndexOpsMixin don't work with magic method.

See original GitHub issue

Assuming that we have Series like the below.

>>> pser = pd.Series([1, 2, 3])
>>> kser = ks.from_pandas(pser)

and there is an issue for some cases with arithmetic ops like the below.

  • rfloordiv
>>> pser.__rfloordiv__(pser)  # it's okay for pandas
0    1
1    1
2    1
Name: 0, dtype: int64

>>> kser.__rfloordiv__(kser)  # but doesn't work for koalas
Traceback (most recent call last):
...
TypeError: Column is not iterable
  • rsub
>>> pser.__rsub__(pser)
0    0
1    0
2    0
Name: 0, dtype: int64

>>> kser.__rsub__(kser)
Traceback (most recent call last):
...
TypeError: Column is not iterable

I think there are more cases have same issue.

Issue Analytics

  • State:open
  • Created 4 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
itholiccommented, Jan 28, 2020

yes right. i just found them very coincidently, and also think it’s not so have high priority to solve for now.

0reactions
HyukjinKwoncommented, Jan 28, 2020

It might be better to fix anyway but I was wondering if it causes a real issue because these dunder methods are not supposed to called directly.

Read more comments on GitHub >

github_iconTop Results From Across the Web

A Guide to Python's Magic Methods « rafekettler.com
A guide to all the Magic Methods in Python. ... Introduction; Construction and Initialization; Making Operators Work on Custom Classes. Comparison magic ...
Read more >
Magic or Dunder Methods in Python - TutorialsTeacher
Magic methods are most frequently used to define overloaded behaviours of predefined operators in Python. For instance, arithmetic operators by default operate ...
Read more >
python: reverse the elements of magic methods that affect ...
Everything works fine but i'm having problems with making the object interact with mathematical operators. This is how you can reproduce the ...
Read more >
Magic Methods - Cambridge Spark
Arithmetic operators. Just like with comparison methods, python allows you to overload arithmetic operators as well. Here we will take a look at...
Read more >
Where are operators mapped to magic methods in Python?
Magic methods are not intended to be invoked directly by you, ... For example, arithmetic operators, by default, operate on numeric operands ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found