Skip to content

Commit 2ff1370

Browse files
authored
Corrected the grammar in Exception (#38216)
* Corrected the grammar in Exception Exception on different arrays' length corrected * Updated error message in tests file as well Co-authored-by: Ashwani <[email protected]>
1 parent 93f57e9 commit 2ff1370

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

pandas/core/apply.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ def wrap_results_for_axis(
360360
try:
361361
result = self.obj._constructor(data=results)
362362
except ValueError as err:
363-
if "arrays must all be same length" in str(err):
363+
if "All arrays must be of the same length" in str(err):
364364
# e.g. result = [[2, 3], [1.5], ['foo', 'bar']]
365365
# see test_agg_listlike_result GH#29587
366366
res = self.obj._constructor_sliced(results)

pandas/core/internals/construction.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def extract_index(data) -> Index:
398398
if have_raw_arrays:
399399
lengths = list(set(raw_lengths))
400400
if len(lengths) > 1:
401-
raise ValueError("arrays must all be same length")
401+
raise ValueError("All arrays must be of the same length")
402402

403403
if have_dicts:
404404
raise ValueError(

pandas/tests/frame/test_constructors.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,7 @@ class CustomDict(dict):
13691369

13701370
def test_constructor_ragged(self):
13711371
data = {"A": np.random.randn(10), "B": np.random.randn(8)}
1372-
with pytest.raises(ValueError, match="arrays must all be same length"):
1372+
with pytest.raises(ValueError, match="All arrays must be of the same length"):
13731373
DataFrame(data)
13741374

13751375
def test_constructor_scalar(self):

0 commit comments

Comments
 (0)