Skip to content

Fixed all warning.warn messages for space,full-stop etc issues #43163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Aug 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ def __getattr__(name):
warnings.warn(
"The pandas.np module is deprecated "
"and will be removed from pandas in a future version. "
"Import numpy directly instead",
"Import numpy directly instead.",
FutureWarning,
stacklevel=2,
)
Expand All @@ -218,7 +218,7 @@ def __getattr__(name):
elif name in {"SparseSeries", "SparseDataFrame"}:
warnings.warn(
f"The {name} class is removed from pandas. Accessing it from "
"the top-level namespace will also be removed in the next version",
"the top-level namespace will also be removed in the next version.",
FutureWarning,
stacklevel=2,
)
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/parsers.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -1000,7 +1000,7 @@ cdef class TextReader:
if col_dtype is not None:
warnings.warn((f"Both a converter and dtype were specified "
f"for column {name} - only the converter will "
f"be used"), ParserWarning,
f"be used."), ParserWarning,
stacklevel=5)
results[i] = _apply_converter(conv, self.parser, i, start, end)
continue
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/nattype.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ cdef class _NaT(datetime):
return True
warnings.warn(
"Comparison of NaT with datetime.date is deprecated in "
"order to match the standard library behavior. "
"order to match the standard library behavior. "
"In a future version these will be considered non-comparable.",
FutureWarning,
stacklevel=1,
Expand Down
4 changes: 2 additions & 2 deletions pandas/_libs/tslibs/offsets.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -696,15 +696,15 @@ cdef class BaseOffset:

def onOffset(self, dt) -> bool:
warnings.warn(
"onOffset is a deprecated, use is_on_offset instead",
"onOffset is a deprecated, use is_on_offset instead.",
FutureWarning,
stacklevel=1,
)
return self.is_on_offset(dt)

def isAnchored(self) -> bool:
warnings.warn(
"isAnchored is a deprecated, use is_anchored instead",
"isAnchored is a deprecated, use is_anchored instead.",
FutureWarning,
stacklevel=1,
)
Expand Down
2 changes: 1 addition & 1 deletion pandas/_libs/tslibs/timedeltas.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -571,7 +571,7 @@ cdef inline timedelta_from_spec(object number, object frac, object unit):
if unit in ["M", "Y", "y"]:
warnings.warn(
"Units 'M', 'Y' and 'y' do not represent unambiguous "
"timedelta values and will be removed in a future version",
"timedelta values and will be removed in a future version.",
FutureWarning,
stacklevel=2,
)
Expand Down
10 changes: 5 additions & 5 deletions pandas/_libs/tslibs/timestamps.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ cdef class _Timestamp(ABCTimestamp):
@property
def freq(self):
warnings.warn(
"Timestamp.freq is deprecated and will be removed in a future version",
"Timestamp.freq is deprecated and will be removed in a future version.",
FutureWarning,
stacklevel=1,
)
Expand Down Expand Up @@ -235,8 +235,8 @@ cdef class _Timestamp(ABCTimestamp):
# We follow the stdlib datetime behavior of never being equal
warnings.warn(
"Comparison of Timestamp with datetime.date is deprecated in "
"order to match the standard library behavior. "
"In a future version these will be considered non-comparable."
"order to match the standard library behavior. "
"In a future version these will be considered non-comparable. "
"Use 'ts == pd.Timestamp(date)' or 'ts.date() == date' instead.",
FutureWarning,
stacklevel=1,
Expand Down Expand Up @@ -425,7 +425,7 @@ cdef class _Timestamp(ABCTimestamp):
warnings.warn(
"Timestamp.freq is deprecated and will be removed in a future "
"version. When you have a freq, use "
f"freq.{field}(timestamp) instead",
f"freq.{field}(timestamp) instead.",
FutureWarning,
stacklevel=1,
)
Expand Down Expand Up @@ -858,7 +858,7 @@ cdef class _Timestamp(ABCTimestamp):
NaT
"""
if self.nanosecond != 0 and warn:
warnings.warn("Discarding nonzero nanoseconds in conversion",
warnings.warn("Discarding nonzero nanoseconds in conversion.",
UserWarning, stacklevel=2)

return datetime(self.year, self.month, self.day,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ def _addsub_object_array(self, other: np.ndarray, op):

warnings.warn(
"Adding/subtracting object-dtype array to "
f"{type(self).__name__} not vectorized",
f"{type(self).__name__} not vectorized.",
PerformanceWarning,
)

Expand Down
8 changes: 4 additions & 4 deletions pandas/core/arrays/datetimes.py
Original file line number Diff line number Diff line change
Expand Up @@ -744,7 +744,7 @@ def _add_offset(self, offset) -> DatetimeArray:

except NotImplementedError:
warnings.warn(
"Non-vectorized DateOffset being applied to Series or DatetimeIndex",
"Non-vectorized DateOffset being applied to Series or DatetimeIndex.",
PerformanceWarning,
)
result = self.astype("O") + offset
Expand Down Expand Up @@ -1186,8 +1186,8 @@ def to_perioddelta(self, freq) -> TimedeltaArray:
# Deprecaation GH#34853
warnings.warn(
"to_perioddelta is deprecated and will be removed in a "
"future version. "
"Use `dtindex - dtindex.to_period(freq).to_timestamp()` instead",
"future version. "
"Use `dtindex - dtindex.to_period(freq).to_timestamp()` instead.",
FutureWarning,
# stacklevel chosen to be correct for when called from DatetimeIndex
stacklevel=3,
Expand Down Expand Up @@ -1353,7 +1353,7 @@ def weekofyear(self):
warnings.warn(
"weekofyear and week have been deprecated, please use "
"DatetimeIndex.isocalendar().week instead, which returns "
"a Series. To exactly reproduce the behavior of week and "
"a Series. To exactly reproduce the behavior of week and "
"weekofyear and return an Index, you may call "
"pd.Int64Index(idx.isocalendar().week)",
FutureWarning,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/arrays/sparse/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ def __init__(
if is_datetime64tz_dtype(data.dtype):
warnings.warn(
f"Creating SparseArray from {data.dtype} data "
"loses timezone information. Cast to object before "
"loses timezone information. Cast to object before "
"sparse to retain timezone information.",
UserWarning,
stacklevel=2,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/computation/align.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ def _align_core(terms):
w = (
f"Alignment difference on axis {axis} is larger "
f"than an order of magnitude on term {repr(terms[i].name)}, "
f"by more than {ordm:.4g}; performance may suffer"
f"by more than {ordm:.4g}; performance may suffer."
)
warnings.warn(w, category=PerformanceWarning, stacklevel=6)

Expand Down
2 changes: 1 addition & 1 deletion pandas/core/computation/expressions.py
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ def _bool_arith_fallback(op_str, a, b):
warnings.warn(
f"evaluating in Python space because the {repr(op_str)} "
"operator is not supported by numexpr for the bool dtype, "
f"use {repr(_BOOL_OP_UNSUPPORTED[op_str])} instead"
f"use {repr(_BOOL_OP_UNSUPPORTED[op_str])} instead."
)
return True
return False
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,7 +767,7 @@ def _try_cast(
f"Could not cast to {dtype}, falling back to object. This "
"behavior is deprecated. In a future version, when a dtype is "
"passed to 'DataFrame', either all columns will be cast to that "
"dtype, or a TypeError will be raised",
"dtype, or a TypeError will be raised.",
FutureWarning,
stacklevel=7,
)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/dtypes/cast.py
Original file line number Diff line number Diff line change
Expand Up @@ -2085,7 +2085,7 @@ def maybe_cast_to_integer_array(
warnings.warn(
f"Constructing Series or DataFrame from {arr.dtype} values and "
f"dtype={dtype} is deprecated and will raise in a future version. "
"Use values.view(dtype) instead",
"Use values.view(dtype) instead.",
FutureWarning,
stacklevel=find_stack_level(),
)
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/dtypes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -302,8 +302,8 @@ def is_categorical(arr) -> bool:
True
"""
warnings.warn(
"is_categorical is deprecated and will be removed in a future version. "
"Use is_categorical_dtype instead",
"is_categorical is deprecated and will be removed in a future version. "
"Use is_categorical_dtype instead.",
FutureWarning,
stacklevel=2,
)
Expand Down
6 changes: 3 additions & 3 deletions pandas/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -4542,9 +4542,9 @@ def lookup(
The found values.
"""
msg = (
"The 'lookup' method is deprecated and will be"
"removed in a future version."
"You can use DataFrame.melt and DataFrame.loc"
"The 'lookup' method is deprecated and will be "
"removed in a future version. "
"You can use DataFrame.melt and DataFrame.loc "
"as a substitute."
)
warnings.warn(msg, FutureWarning, stacklevel=2)
Expand Down
8 changes: 4 additions & 4 deletions pandas/core/generic.py
Original file line number Diff line number Diff line change
Expand Up @@ -8970,7 +8970,7 @@ def where(
if try_cast is not lib.no_default:
warnings.warn(
"try_cast keyword is deprecated and will be removed in a "
"future version",
"future version.",
FutureWarning,
stacklevel=4,
)
Expand Down Expand Up @@ -9003,7 +9003,7 @@ def mask(
if try_cast is not lib.no_default:
warnings.warn(
"try_cast keyword is deprecated and will be removed in a "
"future version",
"future version.",
FutureWarning,
stacklevel=4,
)
Expand Down Expand Up @@ -9196,7 +9196,7 @@ def slice_shift(self: FrameOrSeries, periods: int = 1, axis=0) -> FrameOrSeries:
msg = (
"The 'slice_shift' method is deprecated "
"and will be removed in a future version. "
"You can use DataFrame/Series.shift instead"
"You can use DataFrame/Series.shift instead."
)
warnings.warn(msg, FutureWarning, stacklevel=2)

Expand Down Expand Up @@ -10838,7 +10838,7 @@ def expanding(
axis = self._get_axis_number(axis)
if center is not None:
warnings.warn(
"The `center` argument on `expanding` will be removed in the future",
"The `center` argument on `expanding` will be removed in the future.",
FutureWarning,
stacklevel=2,
)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

# GH#30193
warnings.warn(
"pandas.core.index is deprecated and will be removed in a future version. "
"pandas.core.index is deprecated and will be removed in a future version. "
"The public classes are available in the top-level namespace.",
FutureWarning,
stacklevel=2,
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/accessors.py
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ def weekofyear(self):
Please use Series.dt.isocalendar().week instead.
"""
warnings.warn(
"Series.dt.weekofyear and Series.dt.week have been deprecated. "
"Series.dt.weekofyear and Series.dt.week have been deprecated. "
"Please use Series.dt.isocalendar().week instead.",
FutureWarning,
stacklevel=2,
Expand Down
24 changes: 12 additions & 12 deletions pandas/core/indexes/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,7 @@ def __new__(
warnings.warn(
"Passing keywords other than 'data', 'dtype', 'copy', 'name', "
"'tupleize_cols' is deprecated and will raise TypeError in a "
"future version. Use the specific Index subclass directly instead",
"future version. Use the specific Index subclass directly instead.",
FutureWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -620,7 +620,7 @@ def asi8(self):
An ndarray with int64 dtype.
"""
warnings.warn(
"Index.asi8 is deprecated and will be removed in a future version",
"Index.asi8 is deprecated and will be removed in a future version.",
FutureWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -2469,8 +2469,8 @@ def is_all_dates(self) -> bool:
Whether or not the index values only consist of dates.
"""
warnings.warn(
"Index.is_all_dates is deprecated, will be removed in a future version. "
"check index.inferred_type instead",
"Index.is_all_dates is deprecated, will be removed in a future version. "
"check index.inferred_type instead.",
FutureWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -2835,7 +2835,7 @@ def __and__(self, other):
warnings.warn(
"Index.__and__ operating as a set operation is deprecated, "
"in the future this will be a logical operation matching "
"Series.__and__. Use index.intersection(other) instead",
"Series.__and__. Use index.intersection(other) instead.",
FutureWarning,
stacklevel=2,
)
Expand All @@ -2846,7 +2846,7 @@ def __or__(self, other):
warnings.warn(
"Index.__or__ operating as a set operation is deprecated, "
"in the future this will be a logical operation matching "
"Series.__or__. Use index.union(other) instead",
"Series.__or__. Use index.union(other) instead.",
FutureWarning,
stacklevel=2,
)
Expand All @@ -2857,7 +2857,7 @@ def __xor__(self, other):
warnings.warn(
"Index.__xor__ operating as a set operation is deprecated, "
"in the future this will be a logical operation matching "
"Series.__xor__. Use index.symmetric_difference(other) instead",
"Series.__xor__. Use index.symmetric_difference(other) instead.",
FutureWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -3455,7 +3455,7 @@ def get_loc(self, key, method=None, tolerance=None):
warnings.warn(
f"Passing method to {type(self).__name__}.get_loc is deprecated "
"and will raise in a future version. Use "
"index.get_indexer([item], method=...) instead",
"index.get_indexer([item], method=...) instead.",
FutureWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -3964,7 +3964,7 @@ def reindex(
# GH#42568
warnings.warn(
"reindexing with a non-unique Index is deprecated and "
"will raise in a future version",
"will raise in a future version.",
FutureWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -4695,7 +4695,7 @@ def is_type_compatible(self, kind: str_t) -> bool:
"""
warnings.warn(
"Index.is_type_compatible is deprecated and will be removed in a "
"future version",
"future version.",
FutureWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -5311,7 +5311,7 @@ def get_value(self, series: Series, key):
"""
warnings.warn(
"get_value is deprecated and will be removed in a future version. "
"Use Series[key] instead",
"Use Series[key] instead.",
FutureWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -6861,7 +6861,7 @@ def _maybe_try_sort(result, sort):
result = algos.safe_sort(result)
except TypeError as err:
warnings.warn(
f"{err}, sort order is undefined for incomparable objects",
f"{err}, sort order is undefined for incomparable objects.",
RuntimeWarning,
stacklevel=4,
)
Expand Down
7 changes: 4 additions & 3 deletions pandas/core/indexes/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ def __new__(
warnings.warn(
"Constructing a CategoricalIndex without passing data is "
"deprecated and will raise in a future version. "
"Use CategoricalIndex([], ...) instead",
"Use CategoricalIndex([], ...) instead.",
FutureWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -430,7 +430,7 @@ def reindex(
# GH#42568
warnings.warn(
"reindexing with a non-unique Index is deprecated and will "
"raise in a future version",
"raise in a future version.",
FutureWarning,
stacklevel=2,
)
Expand Down Expand Up @@ -504,7 +504,8 @@ def _is_comparable_dtype(self, dtype: DtypeObj) -> bool:
def take_nd(self, *args, **kwargs):
"""Alias for `take`"""
warnings.warn(
"CategoricalIndex.take_nd is deprecated, use CategoricalIndex.take instead",
"CategoricalIndex.take_nd is deprecated, use CategoricalIndex.take "
"instead.",
FutureWarning,
stacklevel=2,
)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/indexes/datetimelike.py
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,7 @@ def _has_complex_internals(self) -> bool:
def is_type_compatible(self, kind: str) -> bool:
warnings.warn(
f"{type(self).__name__}.is_type_compatible is deprecated and will be "
"removed in a future version",
"removed in a future version.",
FutureWarning,
stacklevel=2,
)
Expand Down
Loading