Skip to content

Commit aab10e8

Browse files
bwignallproost
authored andcommitted
Fix typos, via a Levenshtein-style corrector (pandas-dev#30341)
1 parent c921155 commit aab10e8

File tree

21 files changed

+27
-27
lines changed

21 files changed

+27
-27
lines changed

pandas/_config/config.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,10 @@
5757
DeprecatedOption = namedtuple("DeprecatedOption", "key msg rkey removal_ver")
5858
RegisteredOption = namedtuple("RegisteredOption", "key defval doc validator cb")
5959

60-
# holds deprecated option metdata
60+
# holds deprecated option metadata
6161
_deprecated_options: Dict[str, DeprecatedOption] = {}
6262

63-
# holds registered option metdata
63+
# holds registered option metadata
6464
_registered_options: Dict[str, RegisteredOption] = {}
6565

6666
# holds the current values for registered options

pandas/_libs/groupby.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -791,7 +791,7 @@ def group_quantile(ndarray[float64_t] out,
791791
out[i] = NaN
792792
else:
793793
# Calculate where to retrieve the desired value
794-
# Casting to int will intentionaly truncate result
794+
# Casting to int will intentionally truncate result
795795
idx = grp_start + <int64_t>(q * <float64_t>(non_na_sz - 1))
796796

797797
val = values[sort_arr[idx]]

pandas/_libs/index.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ cdef class IndexEngine:
288288

289289
def get_indexer_non_unique(self, targets):
290290
"""
291-
Return an indexer suitable for takng from a non unique index
291+
Return an indexer suitable for taking from a non unique index
292292
return the labels in the same order ast the target
293293
and a missing indexer into the targets (which correspond
294294
to the -1 indices in the results

pandas/_libs/lib.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -510,7 +510,7 @@ def maybe_booleans_to_slice(ndarray[uint8_t] mask):
510510
@cython.boundscheck(False)
511511
def array_equivalent_object(left: object[:], right: object[:]) -> bool:
512512
"""
513-
Perform an element by element comparion on 1-d object arrays
513+
Perform an element by element comparison on 1-d object arrays
514514
taking into account nan positions.
515515
"""
516516
cdef:

pandas/_libs/src/klib/khash.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -498,7 +498,7 @@ PANDAS_INLINE khint_t __ac_Wang_hash(khint_t key)
498498
*/
499499
#define kh_n_buckets(h) ((h)->n_buckets)
500500

501-
/* More conenient interfaces */
501+
/* More convenient interfaces */
502502

503503
/*! @function
504504
@abstract Instantiate a hash set containing integer keys

pandas/_libs/src/ujson/lib/ultrajsondec.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ FASTCALL_ATTR JSOBJ FASTCALL_MSVC decode_numeric(struct DecoderState *ds) {
150150
case '7':
151151
case '8':
152152
case '9': {
153-
// FIXME: Check for arithemtic overflow here
153+
// FIXME: Check for arithmetic overflow here
154154
// PERF: Don't do 64-bit arithmetic here unless we know we have
155155
// to
156156
intValue = intValue * 10ULL + (JSLONG)(chr - 48);
@@ -235,7 +235,7 @@ FASTCALL_ATTR JSOBJ FASTCALL_MSVC decode_numeric(struct DecoderState *ds) {
235235
}
236236

237237
BREAK_FRC_LOOP:
238-
// FIXME: Check for arithemtic overflow here
238+
// FIXME: Check for arithmetic overflow here
239239
ds->lastType = JT_DOUBLE;
240240
ds->start = offset;
241241
return ds->dec->newDouble(
@@ -282,7 +282,7 @@ FASTCALL_ATTR JSOBJ FASTCALL_MSVC decode_numeric(struct DecoderState *ds) {
282282
}
283283

284284
BREAK_EXP_LOOP:
285-
// FIXME: Check for arithemtic overflow here
285+
// FIXME: Check for arithmetic overflow here
286286
ds->lastType = JT_DOUBLE;
287287
ds->start = offset;
288288
return ds->dec->newDouble(

pandas/_libs/src/ujson/python/objToJSON.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -1632,7 +1632,7 @@ char **NpyArr_encodeLabels(PyArrayObject *labels, PyObjectEncoder *enc,
16321632
sprintf(buf, "%" NPY_INT64_FMT, value);
16331633
len = strlen(cLabel);
16341634
}
1635-
} else { // Fallack to string representation
1635+
} else { // Fallback to string representation
16361636
PyObject *str = PyObject_Str(item);
16371637
if (str == NULL) {
16381638
Py_DECREF(item);

pandas/_libs/tslibs/timestamps.pyx

+1-1
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class Timestamp(_Timestamp):
324324
325325
Function is not implemented. Use pd.to_datetime().
326326
"""
327-
raise NotImplementedError("Timestamp.strptime() is not implmented."
327+
raise NotImplementedError("Timestamp.strptime() is not implemented."
328328
"Use to_datetime() to parse date strings.")
329329

330330
@classmethod

pandas/core/arrays/sparse/dtype.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ def update_dtype(self, dtype):
290290
Returns
291291
-------
292292
SparseDtype
293-
A new SparseDtype with the corret `dtype` and fill value
293+
A new SparseDtype with the correct `dtype` and fill value
294294
for that `dtype`.
295295
296296
Raises

pandas/core/arrays/string_.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def __from_arrow__(self, array):
8686

8787
results = []
8888
for arr in chunks:
89-
# using _from_sequence to ensure None is convered to NA
89+
# using _from_sequence to ensure None is converted to NA
9090
str_arr = StringArray._from_sequence(np.array(arr))
9191
results.append(str_arr)
9292

@@ -153,7 +153,7 @@ class StringArray(PandasArray):
153153
...
154154
ValueError: StringArray requires an object-dtype ndarray of strings.
155155
156-
For comparision methods, this returns a :class:`pandas.BooleanArray`
156+
For comparison methods, this returns a :class:`pandas.BooleanArray`
157157
158158
>>> pd.array(["a", None, "c"], dtype="string") == "a"
159159
<BooleanArray>

pandas/core/groupby/base.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Provide basic components for groupby. These defintiions
2+
Provide basic components for groupby. These definitions
33
hold the whitelist of methods that are exposed on the
44
SeriesGroupBy and the DataFrameGroupBy objects.
55
"""

pandas/core/ops/mask_ops.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""
2-
Ops for masked ararys.
2+
Ops for masked arrays.
33
"""
44
from typing import Optional, Union
55

pandas/io/formats/format.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1640,7 +1640,7 @@ def _get_format_datetime64_from_values(
16401640
""" given values and a date_format, return a string format """
16411641

16421642
if isinstance(values, np.ndarray) and values.ndim > 1:
1643-
# We don't actaully care about the order of values, and DatetimeIndex
1643+
# We don't actually care about the order of values, and DatetimeIndex
16441644
# only accepts 1D values
16451645
values = values.ravel()
16461646

pandas/io/gbq.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def read_gbq(
6565
6666
*New in version 0.2.0 of pandas-gbq*.
6767
dialect : str, default 'legacy'
68-
Note: The default value is changing to 'standard' in a future verion.
68+
Note: The default value is changing to 'standard' in a future version.
6969
7070
SQL syntax dialect to use. Value can be one of:
7171

pandas/io/json/_json.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -314,7 +314,7 @@ def __init__(
314314
timedeltas = obj.select_dtypes(include=["timedelta"]).columns
315315
if len(timedeltas):
316316
obj[timedeltas] = obj[timedeltas].applymap(lambda x: x.isoformat())
317-
# Convert PeriodIndex to datetimes before serialzing
317+
# Convert PeriodIndex to datetimes before serializing
318318
if is_period_dtype(obj.index):
319319
obj.index = obj.index.to_timestamp()
320320

pandas/io/parsers.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -3492,7 +3492,7 @@ def _get_empty_meta(columns, index_col, index_names, dtype=None):
34923492
# 2) index_names (column names)
34933493
#
34943494
# Both must be non-null to ensure a successful construction. Otherwise,
3495-
# we have to create a generic emtpy Index.
3495+
# we have to create a generic empty Index.
34963496
if (index_col is None or index_col is False) or index_names is None:
34973497
index = Index([])
34983498
else:

pandas/tests/extension/json/array.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ def _values_for_factorize(self):
183183

184184
def _values_for_argsort(self):
185185
# Disable NumPy's shape inference by including an empty tuple...
186-
# If all the elemnts of self are the same size P, NumPy will
186+
# If all the elements of self are the same size P, NumPy will
187187
# cast them to an (N, P) array, instead of an (N,) array of tuples.
188188
frozen = [()] + [tuple(x.items()) for x in self]
189189
return np.array(frozen, dtype=object)[1:]

pandas/tests/indexes/datetimes/test_date_range.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -798,7 +798,7 @@ def test_daterange_bug_456(self):
798798
# GH #456
799799
rng1 = bdate_range("12/5/2011", "12/5/2011")
800800
rng2 = bdate_range("12/2/2011", "12/5/2011")
801-
rng2._data.freq = BDay() # TODO: shouldnt this already be set?
801+
rng2._data.freq = BDay() # TODO: shouldn't this already be set?
802802

803803
result = rng1.union(rng2)
804804
assert isinstance(result, DatetimeIndex)
@@ -855,7 +855,7 @@ def test_daterange_bug_456(self):
855855
# GH #456
856856
rng1 = bdate_range("12/5/2011", "12/5/2011", freq="C")
857857
rng2 = bdate_range("12/2/2011", "12/5/2011", freq="C")
858-
rng2._data.freq = CDay() # TODO: shouldnt this already be set?
858+
rng2._data.freq = CDay() # TODO: shouldn't this already be set?
859859

860860
result = rng1.union(rng2)
861861
assert isinstance(result, DatetimeIndex)

pandas/tests/indexes/datetimes/test_tools.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1061,7 +1061,7 @@ class TestToDatetimeUnit:
10611061
@pytest.mark.parametrize("cache", [True, False])
10621062
def test_unit(self, cache):
10631063
# GH 11758
1064-
# test proper behavior with erros
1064+
# test proper behavior with errors
10651065

10661066
with pytest.raises(ValueError):
10671067
to_datetime([1], unit="D", format="%Y%m%d", cache=cache)

pandas/tests/indexes/timedeltas/test_indexing.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ def test_insert(self):
228228
def test_delete(self):
229229
idx = timedelta_range(start="1 Days", periods=5, freq="D", name="idx")
230230

231-
# prserve freq
231+
# preserve freq
232232
expected_0 = timedelta_range(start="2 Days", periods=4, freq="D", name="idx")
233233
expected_4 = timedelta_range(start="1 Days", periods=4, freq="D", name="idx")
234234

@@ -257,7 +257,7 @@ def test_delete(self):
257257
def test_delete_slice(self):
258258
idx = timedelta_range(start="1 days", periods=10, freq="D", name="idx")
259259

260-
# prserve freq
260+
# preserve freq
261261
expected_0_2 = timedelta_range(start="4 days", periods=7, freq="D", name="idx")
262262
expected_7_9 = timedelta_range(start="1 days", periods=7, freq="D", name="idx")
263263

pandas/tests/plotting/test_converter.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ def test_matplotlib_formatters(self):
8484
units = pytest.importorskip("matplotlib.units")
8585

8686
# Can't make any assertion about the start state.
87-
# We we check that toggling converters off remvoes it, and toggling it
87+
# We we check that toggling converters off removes it, and toggling it
8888
# on restores it.
8989

9090
with cf.option_context("plotting.matplotlib.register_converters", True):

0 commit comments

Comments
 (0)