diff --git a/ci/code_checks.sh b/ci/code_checks.sh index ab7bd7895a596..d5566c522ac64 100755 --- a/ci/code_checks.sh +++ b/ci/code_checks.sh @@ -56,7 +56,7 @@ if [[ -z "$CHECK" || "$CHECK" == "lint" ]]; then black --version MSG='Checking black formatting' ; echo $MSG - black . --check --exclude '(asv_bench/env|\.egg|\.git|\.hg|\.mypy_cache|\.nox|\.tox|\.venv|_build|buck-out|build|dist|setup.py)' + black . --check RET=$(($RET + $?)) ; echo $MSG "DONE" # `setup.cfg` contains the list of error codes that are being ignored in flake8 diff --git a/pandas/core/frame.py b/pandas/core/frame.py index ce74081fb655b..ca421e9695888 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -2082,7 +2082,7 @@ def to_stata( data_label=data_label, write_index=write_index, variable_labels=variable_labels, - **kwargs + **kwargs, ) writer.write_file() @@ -2106,7 +2106,7 @@ def to_parquet( compression="snappy", index=None, partition_cols=None, - **kwargs + **kwargs, ): """ Write a DataFrame to the binary parquet format. @@ -2186,7 +2186,7 @@ def to_parquet( compression=compression, index=index, partition_cols=partition_cols, - **kwargs + **kwargs, ) @Substitution( @@ -4110,7 +4110,7 @@ def fillna( inplace=False, limit=None, downcast=None, - **kwargs + **kwargs, ): return super().fillna( value=value, @@ -4119,7 +4119,7 @@ def fillna( inplace=inplace, limit=limit, downcast=downcast, - **kwargs + **kwargs, ) @Appender(_shared_docs["replace"] % _shared_doc_kwargs) @@ -6566,7 +6566,7 @@ def _gotitem( see_also=_agg_summary_and_see_also_doc, examples=_agg_examples_doc, versionadded="\n.. versionadded:: 0.20.0\n", - **_shared_doc_kwargs + **_shared_doc_kwargs, ) @Appender(_shared_docs["aggregate"]) def aggregate(self, func, axis=0, *args, **kwargs): diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 47a0582edbea4..4e024bba3c999 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -2055,7 +2055,7 @@ def __getstate__(self): _typ=self._typ, _metadata=self._metadata, attrs=self.attrs, - **meta + **meta, ) def __setstate__(self, state): @@ -7050,7 +7050,7 @@ def interpolate( limit_direction="forward", limit_area=None, downcast=None, - **kwargs + **kwargs, ): """ Interpolate values according to different methods. @@ -7124,7 +7124,7 @@ def interpolate( limit_area=limit_area, inplace=inplace, downcast=downcast, - **kwargs + **kwargs, ) if inplace: @@ -11572,7 +11572,7 @@ def stat_func( level=None, numeric_only=None, min_count=0, - **kwargs + **kwargs, ): if name == "sum": nv.validate_sum(tuple(), kwargs) diff --git a/pandas/core/groupby/groupby.py b/pandas/core/groupby/groupby.py index 204346bb7b741..280f1e88b0ea8 100644 --- a/pandas/core/groupby/groupby.py +++ b/pandas/core/groupby/groupby.py @@ -1214,7 +1214,7 @@ def median(self, **kwargs): return self._cython_agg_general( "median", alt=lambda x, axis: Series(x).median(axis=axis, **kwargs), - **kwargs + **kwargs, ) @Substitution(name="groupby") @@ -2181,7 +2181,7 @@ def _get_cythonized_result( result_is_index: bool = False, pre_processing=None, post_processing=None, - **kwargs + **kwargs, ): """ Get result for Cythonized functions. diff --git a/pandas/core/indexes/base.py b/pandas/core/indexes/base.py index 20ca176f4a456..9afd35763263d 100644 --- a/pandas/core/indexes/base.py +++ b/pandas/core/indexes/base.py @@ -265,7 +265,7 @@ def __new__( name=None, fastpath=None, tupleize_cols=True, - **kwargs + **kwargs, ) -> "Index": from .range import RangeIndex diff --git a/pandas/core/indexes/datetimes.py b/pandas/core/indexes/datetimes.py index e19ebf17a1b98..aee9be20a1593 100644 --- a/pandas/core/indexes/datetimes.py +++ b/pandas/core/indexes/datetimes.py @@ -1428,7 +1428,7 @@ def date_range( normalize=False, name=None, closed=None, - **kwargs + **kwargs, ): """ Return a fixed frequency DatetimeIndex. @@ -1578,7 +1578,7 @@ def date_range( tz=tz, normalize=normalize, closed=closed, - **kwargs + **kwargs, ) return DatetimeIndex._simple_new(dtarr, tz=dtarr.tz, freq=dtarr.freq, name=name) @@ -1594,7 +1594,7 @@ def bdate_range( weekmask=None, holidays=None, closed=None, - **kwargs + **kwargs, ): """ Return a fixed frequency DatetimeIndex, with business day as the default @@ -1687,7 +1687,7 @@ def bdate_range( normalize=normalize, name=name, closed=closed, - **kwargs + **kwargs, ) diff --git a/pandas/core/indexes/interval.py b/pandas/core/indexes/interval.py index 1c4addfb44839..4a75ab58b7a65 100644 --- a/pandas/core/indexes/interval.py +++ b/pandas/core/indexes/interval.py @@ -935,7 +935,7 @@ def get_loc( None is specified as these are not yet implemented. """ ) - } + }, ) ) @Appender(_index_shared_docs["get_indexer"]) diff --git a/pandas/core/indexes/multi.py b/pandas/core/indexes/multi.py index a83fd6bf59f05..0735030208e20 100644 --- a/pandas/core/indexes/multi.py +++ b/pandas/core/indexes/multi.py @@ -956,7 +956,7 @@ def copy( codes=None, deep=False, _set_identity=False, - **kwargs + **kwargs, ): """ Make a copy of this object. Names, dtype, levels and codes can be @@ -1020,7 +1020,7 @@ def _shallow_copy_with_infer(self, values, **kwargs): return MultiIndex( levels=[[] for _ in range(self.nlevels)], codes=[[] for _ in range(self.nlevels)], - **kwargs + **kwargs, ) return self._shallow_copy(values, **kwargs) diff --git a/pandas/core/indexes/period.py b/pandas/core/indexes/period.py index 2b70049fd14af..2df58b0bbc105 100644 --- a/pandas/core/indexes/period.py +++ b/pandas/core/indexes/period.py @@ -194,7 +194,7 @@ def __new__( dtype=None, copy=False, name=None, - **fields + **fields, ): valid_field_set = { diff --git a/pandas/core/internals/blocks.py b/pandas/core/internals/blocks.py index 5508cf3ca522e..38e1f241c1d77 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -1088,7 +1088,7 @@ def interpolate( fill_value=None, coerce=False, downcast=None, - **kwargs + **kwargs, ): inplace = validate_bool_kwarg(inplace, "inplace") @@ -1138,7 +1138,7 @@ def check_int_bool(self, inplace): fill_value=fill_value, inplace=inplace, downcast=downcast, - **kwargs + **kwargs, ) def _interpolate_with_fill( @@ -1193,7 +1193,7 @@ def _interpolate( limit_area=None, inplace=False, downcast=None, - **kwargs + **kwargs, ): """ interpolate using scipy wrappers """ @@ -1231,7 +1231,7 @@ def func(x): limit_area=limit_area, fill_value=fill_value, bounds_error=False, - **kwargs + **kwargs, ) # interp each column independently @@ -2016,7 +2016,7 @@ def to_native_types( float_format=None, decimal=".", quoting=None, - **kwargs + **kwargs, ): """ convert to our native types format, slicing if desired """ diff --git a/pandas/core/internals/managers.py b/pandas/core/internals/managers.py index 6408da37d4343..96fd4c6bdc6e5 100644 --- a/pandas/core/internals/managers.py +++ b/pandas/core/internals/managers.py @@ -354,7 +354,7 @@ def apply( filter=None, do_integrity_check=False, consolidate=True, - **kwargs + **kwargs, ): """ iterate over the blocks, collect and create a new block manager diff --git a/pandas/core/missing.py b/pandas/core/missing.py index fb148b39c8a86..fc54c03c042b7 100644 --- a/pandas/core/missing.py +++ b/pandas/core/missing.py @@ -164,7 +164,7 @@ def interpolate_1d( fill_value=None, bounds_error=False, order=None, - **kwargs + **kwargs, ): """ Logic for the 1-d interpolation. The result should be 1-d, inputs @@ -300,7 +300,7 @@ def interpolate_1d( fill_value=fill_value, bounds_error=bounds_error, order=order, - **kwargs + **kwargs, ) result[preserve_nans] = np.nan return result diff --git a/pandas/core/resample.py b/pandas/core/resample.py index 79c808cb3951c..5bb0716728778 100644 --- a/pandas/core/resample.py +++ b/pandas/core/resample.py @@ -794,7 +794,7 @@ def interpolate( limit_direction="forward", limit_area=None, downcast=None, - **kwargs + **kwargs, ): """ Interpolate values according to different methods. @@ -808,7 +808,7 @@ def interpolate( limit_direction=limit_direction, limit_area=limit_area, downcast=downcast, - **kwargs + **kwargs, ) def asfreq(self, fill_value=None): @@ -1370,7 +1370,7 @@ def __init__( kind=None, convention=None, base=0, - **kwargs + **kwargs, ): # Check for correctness of the keyword arguments which would # otherwise silently use the default if misspelled diff --git a/pandas/core/reshape/pivot.py b/pandas/core/reshape/pivot.py index 404292fe4d539..ede33c5bd0258 100644 --- a/pandas/core/reshape/pivot.py +++ b/pandas/core/reshape/pivot.py @@ -570,7 +570,7 @@ def crosstab( margins=margins, margins_name=margins_name, dropna=dropna, - **kwargs + **kwargs, ) # Post-process diff --git a/pandas/core/series.py b/pandas/core/series.py index c5e639fef8c5b..d771aefb55844 100644 --- a/pandas/core/series.py +++ b/pandas/core/series.py @@ -3788,7 +3788,7 @@ def _gotitem(self, key, ndim, subset=None): see_also=_agg_see_also_doc, examples=_agg_examples_doc, versionadded="\n.. versionadded:: 0.20.0\n", - **_shared_doc_kwargs + **_shared_doc_kwargs, ) @Appender(generic._shared_docs["aggregate"]) def aggregate(self, func, axis=0, *args, **kwargs): @@ -4012,7 +4012,7 @@ def _reduce( skipna=skipna, numeric_only=numeric_only, filter_type=filter_type, - **kwds + **kwds, ) def _reindex_indexer(self, new_index, indexer, copy): @@ -4249,7 +4249,7 @@ def fillna( inplace=False, limit=None, downcast=None, - **kwargs + **kwargs, ): return super().fillna( value=value, @@ -4258,7 +4258,7 @@ def fillna( inplace=inplace, limit=limit, downcast=downcast, - **kwargs + **kwargs, ) @Appender(generic._shared_docs["replace"] % _shared_doc_kwargs) diff --git a/pandas/core/strings.py b/pandas/core/strings.py index 7194d1cf08e4a..a6e0c12526d8a 100644 --- a/pandas/core/strings.py +++ b/pandas/core/strings.py @@ -1875,7 +1875,7 @@ def _noarg_wrapper( docstring=None, forbidden_types=["bytes"], returns_string=True, - **kargs + **kargs, ): @forbid_nonstring_types(forbidden_types, name=name) def wrapper(self): @@ -1898,7 +1898,7 @@ def _pat_wrapper( name=None, forbidden_types=["bytes"], returns_string=True, - **kwargs + **kwargs, ): @forbid_nonstring_types(forbidden_types, name=name) def wrapper1(self, pat): diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index caf2f9e1c9dd3..fd221c53e244c 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -72,7 +72,7 @@ def __init__( axis: Axis = 0, on: Optional[Union[str, Index]] = None, closed: Optional[str] = None, - **kwargs + **kwargs, ): self.__dict__.update(kwargs) @@ -399,7 +399,7 @@ def _apply( window: Optional[Union[int, str]] = None, center: Optional[bool] = None, check_minp: Optional[Callable] = None, - **kwargs + **kwargs, ): """ Rolling statistical measure using supplied function. diff --git a/pandas/io/common.py b/pandas/io/common.py index 0bef14e4999c7..9b9fe21b56989 100644 --- a/pandas/io/common.py +++ b/pandas/io/common.py @@ -528,7 +528,7 @@ def __init__( file: FilePathOrBuffer, mode: str, archive_name: Optional[str] = None, - **kwargs + **kwargs, ): if mode in ["wb", "rb"]: mode = mode.replace("b", "") diff --git a/pandas/io/excel/_base.py b/pandas/io/excel/_base.py index d0ab6dd37596c..7ad7c40917b9c 100644 --- a/pandas/io/excel/_base.py +++ b/pandas/io/excel/_base.py @@ -304,7 +304,7 @@ def read_excel( skipfooter=0, convert_float=True, mangle_dupe_cols=True, - **kwds + **kwds, ): for arg in ("sheet", "sheetname", "parse_cols"): @@ -344,7 +344,7 @@ def read_excel( skipfooter=skipfooter, convert_float=convert_float, mangle_dupe_cols=mangle_dupe_cols, - **kwds + **kwds, ) @@ -417,7 +417,7 @@ def parse( skipfooter=0, convert_float=True, mangle_dupe_cols=True, - **kwds + **kwds, ): _validate_header_arg(header) @@ -517,7 +517,7 @@ def parse( skipfooter=skipfooter, usecols=usecols, mangle_dupe_cols=mangle_dupe_cols, - **kwds + **kwds, ) output[asheetname] = parser.read(nrows=nrows) @@ -694,7 +694,7 @@ def __init__( date_format=None, datetime_format=None, mode="w", - **engine_kwargs + **engine_kwargs, ): # validate that this engine can handle the extension if isinstance(path, str): @@ -848,7 +848,7 @@ def parse( skipfooter=0, convert_float=True, mangle_dupe_cols=True, - **kwds + **kwds, ): """ Parse specified sheet(s) into a DataFrame. @@ -886,7 +886,7 @@ def parse( skipfooter=skipfooter, convert_float=convert_float, mangle_dupe_cols=mangle_dupe_cols, - **kwds + **kwds, ) @property diff --git a/pandas/io/excel/_xlsxwriter.py b/pandas/io/excel/_xlsxwriter.py index 07bf265da4863..6d9ff9be5249a 100644 --- a/pandas/io/excel/_xlsxwriter.py +++ b/pandas/io/excel/_xlsxwriter.py @@ -168,7 +168,7 @@ def __init__( date_format=None, datetime_format=None, mode="w", - **engine_kwargs + **engine_kwargs, ): # Use the xlsxwriter module as the Excel writer. import xlsxwriter @@ -182,7 +182,7 @@ def __init__( date_format=date_format, datetime_format=datetime_format, mode=mode, - **engine_kwargs + **engine_kwargs, ) self.book = xlsxwriter.Workbook(path, **engine_kwargs) diff --git a/pandas/io/formats/format.py b/pandas/io/formats/format.py index 17603809c2ea6..41bddc7683764 100644 --- a/pandas/io/formats/format.py +++ b/pandas/io/formats/format.py @@ -1437,7 +1437,7 @@ def __init__( values: Union[np.ndarray, "Series", DatetimeIndex, DatetimeArray], nat_rep: str = "NaT", date_format: None = None, - **kwargs + **kwargs, ): super().__init__(values, **kwargs) self.nat_rep = nat_rep @@ -1658,7 +1658,7 @@ def __init__( values: Union[np.ndarray, TimedeltaIndex], nat_rep: str = "NaT", box: bool = False, - **kwargs + **kwargs, ): super().__init__(values, **kwargs) self.nat_rep = nat_rep diff --git a/pandas/io/gbq.py b/pandas/io/gbq.py index d29078cad9318..b120de1b3011a 100644 --- a/pandas/io/gbq.py +++ b/pandas/io/gbq.py @@ -173,7 +173,7 @@ def read_gbq( location=location, configuration=configuration, credentials=credentials, - **kwargs + **kwargs, ) diff --git a/pandas/io/parquet.py b/pandas/io/parquet.py index 69ee6583d12c8..edbf60cc91d0b 100644 --- a/pandas/io/parquet.py +++ b/pandas/io/parquet.py @@ -89,7 +89,7 @@ def write( coerce_timestamps="ms", index=None, partition_cols=None, - **kwargs + **kwargs, ): self.validate_dataframe(df) path, _, _, _ = get_filepath_or_buffer(path, mode="wb") @@ -106,7 +106,7 @@ def write( compression=compression, coerce_timestamps=coerce_timestamps, partition_cols=partition_cols, - **kwargs + **kwargs, ) else: self.api.parquet.write_table( @@ -114,7 +114,7 @@ def write( path, compression=compression, coerce_timestamps=coerce_timestamps, - **kwargs + **kwargs, ) def read(self, path, columns=None, **kwargs): @@ -176,7 +176,7 @@ def write( compression=compression, write_index=index, partition_on=partition_cols, - **kwargs + **kwargs, ) def read(self, path, columns=None, **kwargs): @@ -205,7 +205,7 @@ def to_parquet( compression="snappy", index=None, partition_cols=None, - **kwargs + **kwargs, ): """ Write a DataFrame to the parquet format. @@ -252,7 +252,7 @@ def to_parquet( compression=compression, index=index, partition_cols=partition_cols, - **kwargs + **kwargs, ) diff --git a/pandas/io/parsers.py b/pandas/io/parsers.py index 058d65b9464ae..dba96358227c3 100755 --- a/pandas/io/parsers.py +++ b/pandas/io/parsers.py @@ -707,7 +707,7 @@ def read_fwf( colspecs="infer", widths=None, infer_nrows=100, - **kwds + **kwds, ): r""" diff --git a/pandas/plotting/_core.py b/pandas/plotting/_core.py index 6fc5b03920cba..6c3d70271fc12 100644 --- a/pandas/plotting/_core.py +++ b/pandas/plotting/_core.py @@ -23,7 +23,7 @@ def hist_series( figsize=None, bins=10, backend=None, - **kwargs + **kwargs, ): """ Draw histogram of the input series using matplotlib. @@ -83,7 +83,7 @@ def hist_series( yrot=yrot, figsize=figsize, bins=bins, - **kwargs + **kwargs, ) @@ -103,7 +103,7 @@ def hist_frame( layout=None, bins=10, backend=None, - **kwargs + **kwargs, ): """ Make a histogram of the DataFrame's. @@ -206,7 +206,7 @@ def hist_frame( figsize=figsize, layout=layout, bins=bins, - **kwargs + **kwargs, ) @@ -400,7 +400,7 @@ def boxplot( figsize=None, layout=None, return_type=None, - **kwargs + **kwargs, ): plot_backend = _get_plot_backend("matplotlib") return plot_backend.boxplot( @@ -414,7 +414,7 @@ def boxplot( figsize=figsize, layout=layout, return_type=return_type, - **kwargs + **kwargs, ) @@ -432,7 +432,7 @@ def boxplot_frame( layout=None, return_type=None, backend=None, - **kwargs + **kwargs, ): plot_backend = _get_plot_backend(backend) return plot_backend.boxplot_frame( @@ -446,7 +446,7 @@ def boxplot_frame( figsize=figsize, layout=layout, return_type=return_type, - **kwargs + **kwargs, ) @@ -463,7 +463,7 @@ def boxplot_frame_groupby( sharex=False, sharey=True, backend=None, - **kwargs + **kwargs, ): """ Make box plots from DataFrameGroupBy data. @@ -536,7 +536,7 @@ def boxplot_frame_groupby( layout=layout, sharex=sharex, sharey=sharey, - **kwargs + **kwargs, ) diff --git a/pandas/plotting/_matplotlib/boxplot.py b/pandas/plotting/_matplotlib/boxplot.py index cfd6c3519d82c..274f06cd3ec1d 100644 --- a/pandas/plotting/_matplotlib/boxplot.py +++ b/pandas/plotting/_matplotlib/boxplot.py @@ -184,7 +184,7 @@ def _grouped_plot_by_column( ax=None, layout=None, return_type=None, - **kwargs + **kwargs, ): grouped = data.groupby(by) if columns is None: @@ -234,7 +234,7 @@ def boxplot( figsize=None, layout=None, return_type=None, - **kwds + **kwds, ): import matplotlib.pyplot as plt @@ -359,7 +359,7 @@ def boxplot_frame( figsize=None, layout=None, return_type=None, - **kwds + **kwds, ): import matplotlib.pyplot as plt @@ -374,7 +374,7 @@ def boxplot_frame( figsize=figsize, layout=layout, return_type=return_type, - **kwds + **kwds, ) plt.draw_if_interactive() return ax @@ -392,7 +392,7 @@ def boxplot_frame_groupby( layout=None, sharex=False, sharey=True, - **kwds + **kwds, ): if subplots is True: naxes = len(grouped) @@ -432,6 +432,6 @@ def boxplot_frame_groupby( ax=ax, figsize=figsize, layout=layout, - **kwds + **kwds, ) return ret diff --git a/pandas/plotting/_matplotlib/core.py b/pandas/plotting/_matplotlib/core.py index 5853367f71d56..5341dc3a6338a 100644 --- a/pandas/plotting/_matplotlib/core.py +++ b/pandas/plotting/_matplotlib/core.py @@ -102,7 +102,7 @@ def __init__( table=False, layout=None, include_bool=False, - **kwds + **kwds, ): import matplotlib.pyplot as plt @@ -985,7 +985,7 @@ def _make_plot(self): c=c_values, label=label, cmap=cmap, - **self.kwds + **self.kwds, ) if cb: cbar_label = c if c_is_column else "" @@ -1095,7 +1095,7 @@ def _make_plot(self): column_num=i, stacking_id=stacking_id, is_errorbar=is_errorbar, - **kwds + **kwds, ) self._add_legend_handle(newlines[0], label, index=i) @@ -1250,7 +1250,7 @@ def _plot( column_num=None, stacking_id=None, is_errorbar=False, - **kwds + **kwds, ): if column_num == 0: @@ -1386,7 +1386,7 @@ def _make_plot(self): start=start, label=label, log=self.log, - **kwds + **kwds, ) ax.set_title(label) elif self.stacked: @@ -1401,7 +1401,7 @@ def _make_plot(self): start=start, label=label, log=self.log, - **kwds + **kwds, ) pos_prior = pos_prior + np.where(mask, y, 0) neg_prior = neg_prior + np.where(mask, 0, y) @@ -1415,7 +1415,7 @@ def _make_plot(self): start=start, label=label, log=self.log, - **kwds + **kwds, ) self._add_legend_handle(rect, label, index=i) diff --git a/pandas/plotting/_matplotlib/hist.py b/pandas/plotting/_matplotlib/hist.py index c4ac9ead3f3d3..b60e8fa8a3f7c 100644 --- a/pandas/plotting/_matplotlib/hist.py +++ b/pandas/plotting/_matplotlib/hist.py @@ -49,7 +49,7 @@ def _plot( bottom=0, column_num=0, stacking_id=None, - **kwds + **kwds, ): if column_num == 0: cls._initialize_stacker(ax, stacking_id, len(bins) - 1) @@ -145,7 +145,7 @@ def _plot( ind=None, column_num=None, stacking_id=None, - **kwds + **kwds, ): from scipy.stats import gaussian_kde @@ -177,7 +177,7 @@ def _grouped_plot( layout=None, rot=0, ax=None, - **kwargs + **kwargs, ): if figsize == "default": @@ -226,7 +226,7 @@ def _grouped_hist( xrot=None, ylabelsize=None, yrot=None, - **kwargs + **kwargs, ): """ Grouped histogram @@ -290,7 +290,7 @@ def hist_series( yrot=None, figsize=None, bins=10, - **kwds + **kwds, ): import matplotlib.pyplot as plt @@ -335,7 +335,7 @@ def hist_series( xrot=xrot, ylabelsize=ylabelsize, yrot=yrot, - **kwds + **kwds, ) if hasattr(axes, "ndim"): @@ -359,7 +359,7 @@ def hist_frame( figsize=None, layout=None, bins=10, - **kwds + **kwds, ): if by is not None: axes = _grouped_hist( @@ -377,7 +377,7 @@ def hist_frame( xrot=xrot, ylabelsize=ylabelsize, yrot=yrot, - **kwds + **kwds, ) return axes diff --git a/pandas/plotting/_matplotlib/misc.py b/pandas/plotting/_matplotlib/misc.py index 6d5a94c4d5ff8..6d2363668e650 100644 --- a/pandas/plotting/_matplotlib/misc.py +++ b/pandas/plotting/_matplotlib/misc.py @@ -22,7 +22,7 @@ def scatter_matrix( density_kwds=None, hist_kwds=None, range_padding=0.05, - **kwds + **kwds, ): df = frame._get_numeric_data() n = df.columns.size @@ -160,7 +160,7 @@ def normalize(series): to_plot[kls][1], color=colors[i], label=pprint_thing(kls), - **kwds + **kwds, ) ax.legend() @@ -315,7 +315,7 @@ def parallel_coordinates( axvlines=True, axvlines_kwds=None, sort_labels=False, - **kwds + **kwds, ): import matplotlib.pyplot as plt diff --git a/pandas/plotting/_matplotlib/tools.py b/pandas/plotting/_matplotlib/tools.py index caa0167c06389..bcbe5eea8b5ab 100644 --- a/pandas/plotting/_matplotlib/tools.py +++ b/pandas/plotting/_matplotlib/tools.py @@ -101,7 +101,7 @@ def _subplots( ax=None, layout=None, layout_type="box", - **fig_kw + **fig_kw, ): """Create a figure with a set of subplots already made. diff --git a/pandas/plotting/_misc.py b/pandas/plotting/_misc.py index 59cbdb0318e5a..6c8bcdada5957 100644 --- a/pandas/plotting/_misc.py +++ b/pandas/plotting/_misc.py @@ -82,7 +82,7 @@ def scatter_matrix( density_kwds=None, hist_kwds=None, range_padding=0.05, - **kwargs + **kwargs, ): """ Draw a matrix of scatter plots. @@ -134,7 +134,7 @@ def scatter_matrix( density_kwds=density_kwds, hist_kwds=hist_kwds, range_padding=range_padding, - **kwargs + **kwargs, ) @@ -207,7 +207,7 @@ def radviz(frame, class_column, ax=None, color=None, colormap=None, **kwds): ax=ax, color=color, colormap=colormap, - **kwds + **kwds, ) @@ -255,7 +255,7 @@ def andrews_curves( samples=samples, color=color, colormap=colormap, - **kwargs + **kwargs, ) @@ -325,7 +325,7 @@ def parallel_coordinates( axvlines=True, axvlines_kwds=None, sort_labels=False, - **kwargs + **kwargs, ): """ Parallel coordinates plotting. @@ -383,7 +383,7 @@ def parallel_coordinates( axvlines=axvlines, axvlines_kwds=axvlines_kwds, sort_labels=sort_labels, - **kwargs + **kwargs, ) diff --git a/pandas/tests/groupby/test_categorical.py b/pandas/tests/groupby/test_categorical.py index a187781ea214c..663e03aa1bc81 100644 --- a/pandas/tests/groupby/test_categorical.py +++ b/pandas/tests/groupby/test_categorical.py @@ -1127,7 +1127,7 @@ def test_seriesgroupby_observed_true(df_cat, operation, kwargs): index = MultiIndex.from_frame( DataFrame( {"A": ["foo", "foo", "bar", "bar"], "B": ["one", "two", "one", "three"]}, - **kwargs + **kwargs, ) ) expected = Series(data=[1, 3, 2, 4], index=index, name="C") diff --git a/pandas/tests/reshape/test_pivot.py b/pandas/tests/reshape/test_pivot.py index a8386d21ba27f..5b6dc70894857 100644 --- a/pandas/tests/reshape/test_pivot.py +++ b/pandas/tests/reshape/test_pivot.py @@ -581,23 +581,23 @@ def test_pivot_tz_in_values(self): df = pd.DataFrame( [ { - "uid": u"aa", + "uid": "aa", "ts": pd.Timestamp("2016-08-12 13:00:00-0700", tz="US/Pacific"), }, { - "uid": u"aa", + "uid": "aa", "ts": pd.Timestamp("2016-08-12 08:00:00-0700", tz="US/Pacific"), }, { - "uid": u"aa", + "uid": "aa", "ts": pd.Timestamp("2016-08-12 14:00:00-0700", tz="US/Pacific"), }, { - "uid": u"aa", + "uid": "aa", "ts": pd.Timestamp("2016-08-25 11:00:00-0700", tz="US/Pacific"), }, { - "uid": u"aa", + "uid": "aa", "ts": pd.Timestamp("2016-08-25 13:00:00-0700", tz="US/Pacific"), }, ] diff --git a/pandas/tests/test_multilevel.py b/pandas/tests/test_multilevel.py index 3b194044131a8..cd6acafc394c5 100644 --- a/pandas/tests/test_multilevel.py +++ b/pandas/tests/test_multilevel.py @@ -363,19 +363,19 @@ def test_unstack(self): [ ( [[1, 1, None, None, 30.0, None], [2, 2, None, None, 30.0, None]], - [u"ix1", u"ix2", u"col1", u"col2", u"col3", u"col4"], + ["ix1", "ix2", "col1", "col2", "col3", "col4"], 2, [None, None, 30.0, None], ), ( [[1, 1, None, None, 30.0], [2, 2, None, None, 30.0]], - [u"ix1", u"ix2", u"col1", u"col2", u"col3"], + ["ix1", "ix2", "col1", "col2", "col3"], 2, [None, None, 30.0], ), ( [[1, 1, None, None, 30.0], [2, None, None, None, 30.0]], - [u"ix1", u"ix2", u"col1", u"col2", u"col3"], + ["ix1", "ix2", "col1", "col2", "col3"], None, [None, None, 30.0], ), @@ -389,7 +389,7 @@ def test_unstack_partial( # make sure DataFrame.unstack() works when its run on a subset of the DataFrame # and the Index levels contain values that are not present in the subset result = pd.DataFrame(result_rows, columns=result_columns).set_index( - [u"ix1", "ix2"] + ["ix1", "ix2"] ) result = result.iloc[1:2].unstack("ix2") expected = pd.DataFrame( diff --git a/pandas/tests/test_nanops.py b/pandas/tests/test_nanops.py index 52ad56967220f..7b76a1c0a6c86 100644 --- a/pandas/tests/test_nanops.py +++ b/pandas/tests/test_nanops.py @@ -151,7 +151,7 @@ def check_fun_data( targarval, check_dtype=True, empty_targfunc=None, - **kwargs + **kwargs, ): for axis in list(range(targarval.ndim)) + [None]: for skipna in [False, True]: @@ -186,7 +186,7 @@ def check_fun_data( targarval2, check_dtype=check_dtype, empty_targfunc=empty_targfunc, - **kwargs + **kwargs, ) def check_fun(self, testfunc, targfunc, testar, empty_targfunc=None, **kwargs): @@ -203,7 +203,7 @@ def check_fun(self, testfunc, targfunc, testar, empty_targfunc=None, **kwargs): testarval, targarval, empty_targfunc=empty_targfunc, - **kwargs + **kwargs, ) def check_funs( @@ -215,7 +215,7 @@ def check_funs( allow_date=True, allow_tdelta=True, allow_obj=True, - **kwargs + **kwargs, ): self.check_fun(testfunc, targfunc, "arr_float", **kwargs) self.check_fun(testfunc, targfunc, "arr_float_nan", **kwargs) @@ -476,7 +476,7 @@ def check_nancorr_nancov_2d(self, checkfun, targ0, targ1, **kwargs): self.arr_float_2d, self.arr_float1_2d, min_periods=len(self.arr_float_2d) - 1, - **kwargs + **kwargs, ) tm.assert_almost_equal(targ0, res00) tm.assert_almost_equal(targ0, res01) @@ -486,7 +486,7 @@ def check_nancorr_nancov_2d(self, checkfun, targ0, targ1, **kwargs): self.arr_float_nan_2d, self.arr_float1_nan_2d, min_periods=len(self.arr_float_2d) - 1, - **kwargs + **kwargs, ) tm.assert_almost_equal(targ1, res10) tm.assert_almost_equal(targ1, res11) @@ -500,13 +500,13 @@ def check_nancorr_nancov_2d(self, checkfun, targ0, targ1, **kwargs): self.arr_float_nan_2d, self.arr_nan_float1_2d, min_periods=len(self.arr_float_2d) - 1, - **kwargs + **kwargs, ) res25 = checkfun( self.arr_float_2d, self.arr_float1_2d, min_periods=len(self.arr_float_2d) + 1, - **kwargs + **kwargs, ) tm.assert_almost_equal(targ2, res20) tm.assert_almost_equal(targ2, res21) @@ -521,7 +521,7 @@ def check_nancorr_nancov_1d(self, checkfun, targ0, targ1, **kwargs): self.arr_float_1d, self.arr_float1_1d, min_periods=len(self.arr_float_1d) - 1, - **kwargs + **kwargs, ) tm.assert_almost_equal(targ0, res00) tm.assert_almost_equal(targ0, res01) @@ -531,7 +531,7 @@ def check_nancorr_nancov_1d(self, checkfun, targ0, targ1, **kwargs): self.arr_float_nan_1d, self.arr_float1_nan_1d, min_periods=len(self.arr_float_1d) - 1, - **kwargs + **kwargs, ) tm.assert_almost_equal(targ1, res10) tm.assert_almost_equal(targ1, res11) @@ -545,13 +545,13 @@ def check_nancorr_nancov_1d(self, checkfun, targ0, targ1, **kwargs): self.arr_float_nan_1d, self.arr_nan_float1_1d, min_periods=len(self.arr_float_1d) - 1, - **kwargs + **kwargs, ) res25 = checkfun( self.arr_float_1d, self.arr_float1_1d, min_periods=len(self.arr_float_1d) + 1, - **kwargs + **kwargs, ) tm.assert_almost_equal(targ2, res20) tm.assert_almost_equal(targ2, res21) diff --git a/pandas/tests/window/test_moments.py b/pandas/tests/window/test_moments.py index 36a0ddb3e02d7..6e4bc621d7f49 100644 --- a/pandas/tests/window/test_moments.py +++ b/pandas/tests/window/test_moments.py @@ -800,7 +800,7 @@ def _check_moment_func( has_time_rule=True, fill_value=None, zero_min_periods_equal=True, - **kwargs + **kwargs, ): # inject raw diff --git a/pandas/util/testing.py b/pandas/util/testing.py index 4ba32c377a345..2b4cb322fc966 100644 --- a/pandas/util/testing.py +++ b/pandas/util/testing.py @@ -316,7 +316,7 @@ def assert_almost_equal( check_exact=False, exact=check_dtype, check_less_precise=check_less_precise, - **kwargs + **kwargs, ) elif isinstance(left, pd.Series): @@ -326,7 +326,7 @@ def assert_almost_equal( check_exact=False, check_dtype=check_dtype, check_less_precise=check_less_precise, - **kwargs + **kwargs, ) elif isinstance(left, pd.DataFrame): @@ -336,7 +336,7 @@ def assert_almost_equal( check_exact=False, check_dtype=check_dtype, check_less_precise=check_less_precise, - **kwargs + **kwargs, ) else: @@ -359,7 +359,7 @@ def assert_almost_equal( right, check_dtype=check_dtype, check_less_precise=check_less_precise, - **kwargs + **kwargs, ) diff --git a/pyproject.toml b/pyproject.toml index b105f8aeb3291..28d7c3d55c919 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -10,3 +10,23 @@ requires = [ "numpy==1.16.0; python_version=='3.6' and platform_system=='AIX'", "numpy==1.16.0; python_version>='3.7' and platform_system=='AIX'", ] + +[tool.black] +target-version = ['py36', 'py37', 'py38'] +exclude = ''' +( + asv_bench/env + | \.egg + | \.git + | \.hg + | \.mypy_cache + | \.nox + | \.tox + | \.venv + | _build + | buck-out + | build + | dist + | setup.py +) +'''