@@ -568,89 +568,6 @@ def agg(self, agg):
568568 force_execution_mode = self ._force_execution_mode ,
569569 )
570570
571- def value_counts (self , dropna , columns , sort , ascending ):
572- """
573- Count unique rows operation.
574-
575- Parameters
576- ----------
577- dropna : bool
578- True when rows with NULLs should be ignored.
579- columns : list-like of str or None
580- Columns to use for unique combinations count. Use all
581- columns when None.
582- sort : bool
583- Sort by frequencies.
584- ascending : bool
585- Sort order.
586-
587- Returns
588- -------
589- OmnisciOnNativeFrame
590- The new frame.
591- """
592- by = [col for col in self .columns if columns is None or col in columns ]
593-
594- if not by :
595- raise ValueError ("invalid columns subset is specified" )
596-
597- base = self
598- if dropna :
599- checks = [base .ref (col ).is_not_null () for col in by ]
600- condition = (
601- checks [0 ]
602- if len (checks ) == 1
603- else OpExpr ("AND" , [checks ], np .dtype ("bool" ))
604- )
605- base = self .__constructor__ (
606- columns = Index .__new__ (Index , data = by , dtype = "O" ),
607- dtypes = base ._dtypes [by ],
608- op = FilterNode (base , condition ),
609- index_cols = None ,
610- force_execution_mode = base ._force_execution_mode ,
611- )
612-
613- agg_exprs = OrderedDict ()
614- agg_exprs ["" ] = AggregateExpr ("size" , None )
615- dtypes = base ._dtypes [by ].tolist ()
616- dtypes .append (np .dtype ("int64" ))
617-
618- new_columns = Index .__new__ (Index , data = ["" ], dtype = "O" )
619-
620- res = self .__constructor__ (
621- columns = new_columns ,
622- dtypes = dtypes ,
623- op = GroupbyAggNode (base , by , agg_exprs , {"sort" : False }),
624- index_cols = by .copy (),
625- force_execution_mode = base ._force_execution_mode ,
626- )
627-
628- if sort or ascending :
629- res = self .__constructor__ (
630- columns = res .columns ,
631- dtypes = res ._dtypes ,
632- op = SortNode (res , ["" ], [ascending ], "last" ),
633- index_cols = res ._index_cols ,
634- force_execution_mode = res ._force_execution_mode ,
635- )
636-
637- # If a single column is used then it keeps its name.
638- # TODO: move it to upper levels when index renaming is in place.
639- if len (by ) == 1 :
640- exprs = OrderedDict ()
641- exprs ["__index__" ] = res .ref (by [0 ])
642- exprs [by [0 ]] = res .ref ("" )
643-
644- res = self .__constructor__ (
645- columns = Index .__new__ (Index , data = by , dtype = "O" ),
646- dtypes = self ._dtypes_for_exprs (exprs ),
647- op = TransformNode (res , exprs ),
648- index_cols = ["__index__" ],
649- force_execution_mode = res ._force_execution_mode ,
650- )
651-
652- return res
653-
654571 def fillna (self , value = None , method = None , axis = None , limit = None , downcast = None ):
655572 """
656573 Replace NULLs operation.
0 commit comments