b5dca485575de7052f2ce8f39ea845e848e1ac89,janitor/functions.py,,fill_direction,#Any#Any#Any#,4261
Before Change
// should be removed once the minimum Pandas version is 1.1,
// as Pandas loc will raise a KeyError if columns provided do not exist
wrong_columns_provided = set(directions).difference(df.columns)
if any(wrong_columns_provided):
if len(wrong_columns_provided) > 1:
outcome = ", ".join(f""{word}"" for word in wrong_columns_provided)
raise ValueError(
f"Columns {outcome} do not exist in the dataframe."
)
outcome = "".join(wrong_columns_provided)
raise ValueError(f"Column {outcome} does not exist in the dataframe.")
// check that the right directions are provided
set_directions = {"up", "down", "updown", "downup"}
// linter throws an error when I use dictionary.values()
// it assumes that dictionary is a dataframe
After Change
check("directions", directions, [dict])
if limit is not None:
check("limit", limit, [int])
// pandas raises error if limit is not greater than zero
// so no need for a check on pyjanitor"s end
check_column(df, directions)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 5
Instances Project Name: ericmjl/pyjanitor
Commit Name: b5dca485575de7052f2ce8f39ea845e848e1ac89
Time: 2020-12-09
Author: samueloranyeli@gmail.com
File Name: janitor/functions.py
Class Name:
Method Name: fill_direction
Project Name: keras-team/autokeras
Commit Name: 5b8b1c9419fca922ae4e670d1d6c798f833f0268
Time: 2020-04-07
Author: abraham.g.sebastian@gmail.com
File Name: autokeras/tasks/structured_data.py
Class Name: SupervisedStructuredDataPipeline
Method Name: __init__