Open Zeroto521 opened 2 years ago
There always has an option called column_name or column_names. It's used to select the columns of df. The type could be a single value like Hashable and list values likes Iterable[Hashable]. And this idea is to support callback type.
column_name
column_names
df
Hashable
Iterable[Hashable]
_Originally posted by @ericmjl in https://github.com/pyjanitor-devs/pyjanitor/pull/1112#discussion_r895257358_
An implicit style and also a trick to select columns.
df.columns
lambda df: df.columns[:3]
['a', 'b', 'c']
lambda df: [i for i in df.columns if instance(i, str)]
For this, we can pass callables to select_columns
select_columns
Brief Description
There always has an option called
column_name
orcolumn_names
. It's used to select the columns ofdf
. The type could be a single value likeHashable
and list values likesIterable[Hashable]
. And this idea is to support callback type._Originally posted by @ericmjl in https://github.com/pyjanitor-devs/pyjanitor/pull/1112#discussion_r895257358_
Example API
An implicit style and also a trick to select columns.
df.columns
lambda df: df.columns[:3]
['a', 'b', 'c']
lambda df: [i for i in df.columns if instance(i, str)]
['a', 'b', 'c']