datar: f.duplicated() not working in filter

Sometimes I wanna keep all the duplicated rows. While in pandas, done like this mtcarss[mtcars.duplicated(keep=False)] In datar, it does not work.

from datar.all import * 
from datar.datasets import mtcars

mtcars >> select('cyl','hp','gear','disp')>> filter(f.duplicated(keep=False))

But in the follow two ways,it works.

# 1  f.series 

mtcars >> select('cyl','hp','gear','disp')>> filter(f.cyl.duplicated(keep=False))
# 2 select all the columns 

mtcars >> select('cyl','hp','gear','disp')>> filter(f['cyl'].duplicated(keep=False))

It seems that only series can be passed to the filter

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 27 (13 by maintainers)

Most upvoted comments

Just to mention, @machow and @pwwang , you are doing a huge contribution to the community by bringing the best part of R to fill the messiest most annoying part of Python, which in my opinion is data wrangling.