tidypandas icon indicating copy to clipboard operation
tidypandas copied to clipboard

[feature] Implement `tidyselect`

Open talegari opened this issue 2 years ago • 4 comments

Column names should also support functions along with strings: df.select(['a', 'b', 'c']) # regular df.select(['a', 'b', starts_with('c'), ends_with('d'), contains('some_regex')])

tidyselect should power all the methods that take column_names as the input.

talegari avatar Jun 29 '22 02:06 talegari

Also, replace_na, should be changed to accept list of columns and/or column selector in the key of the dictionary being passed.

Also, is the value appropriate argument name in replace_na?

grahitr avatar Jan 25 '23 04:01 grahitr

IMHO, value should be a single value for simplicity. If we allow a list of values to be passed, then we implicitly already the columns to be renamed right?

my suggestion: df.replace_na({ends_with("width"): 0}) and not df.replace_na({ends_with("width"): [0, 1]}) as in latter case, usually we might not know how many columns get selected.

talegari avatar Jan 25 '23 06:01 talegari

To expand tidyselect for following methods

count add_count nest_by expand complete Summarise -> in by Mutate -> in by

grahitr avatar Aug 06 '23 13:08 grahitr

Is there is an easy way to filter using tidyselect. Like:

df.filter(starts_with("x") < 10)

sardnar avatar Nov 23 '23 08:11 sardnar