Skip to content

Commit

Permalink
Corrected the grammar in Exception (#38216)
Browse files Browse the repository at this point in the history
* Corrected the grammar in Exception

Exception on different arrays' length corrected

* Updated error message in tests file as well

Co-authored-by: Ashwani <ashwani.ashwani@external.thalesgroup.com>
  • Loading branch information
imaskm and imaskm authored Dec 10, 2020
1 parent 93f57e9 commit 2ff1370
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pandas/core/apply.py
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ def wrap_results_for_axis(
try:
result = self.obj._constructor(data=results)
except ValueError as err:
if "arrays must all be same length" in str(err):
if "All arrays must be of the same length" in str(err):
# e.g. result = [[2, 3], [1.5], ['foo', 'bar']]
# see test_agg_listlike_result GH#29587
res = self.obj._constructor_sliced(results)
Expand Down
2 changes: 1 addition & 1 deletion pandas/core/internals/construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ def extract_index(data) -> Index:
if have_raw_arrays:
lengths = list(set(raw_lengths))
if len(lengths) > 1:
raise ValueError("arrays must all be same length")
raise ValueError("All arrays must be of the same length")

if have_dicts:
raise ValueError(
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/frame/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ class CustomDict(dict):

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

def test_constructor_scalar(self):
Expand Down

0 comments on commit 2ff1370

Please sign in to comment.