Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/pandas-dev/pandas
Browse files Browse the repository at this point in the history
  • Loading branch information
datajanko committed Sep 14, 2019
2 parents 2897723 + ad9fe5d commit a54e1b4
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 13 deletions.
4 changes: 2 additions & 2 deletions doc/source/development/contributing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ We'll now kick off a three-step process:
# Build and install pandas
python setup.py build_ext --inplace -j 4
python -m pip install -e --no-build-isolation .
python -m pip install -e . --no-build-isolation
At this point you should be able to import pandas from your locally built version::

Expand Down Expand Up @@ -252,7 +252,7 @@ You'll need to have at least python3.5 installed on your system.
# Build and install pandas
python setup.py build_ext --inplace -j 4
python -m pip install -e --no-build-isolation .
python -m pip install -e . --no-build-isolation
Creating a branch
-----------------
Expand Down
4 changes: 2 additions & 2 deletions pandas/core/arrays/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,10 +245,10 @@ def construct_from_string(cls, string):
if string.startswith("Sparse"):
try:
sub_type, has_fill_value = cls._parse_subtype(string)
result = SparseDtype(sub_type)
except Exception:
except ValueError:
raise TypeError(msg)
else:
result = SparseDtype(sub_type)
msg = (
"Could not construct SparseDtype from '{}'.\n\nIt "
"looks like the fill_value in the string is not "
Expand Down
6 changes: 2 additions & 4 deletions pandas/core/dtypes/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -2049,10 +2049,8 @@ def pandas_dtype(dtype):
# raise a consistent TypeError if failed
try:
npdtype = np.dtype(dtype)
except Exception:
# we don't want to force a repr of the non-string
if not isinstance(dtype, str):
raise TypeError("data type not understood")
except SyntaxError:
# np.dtype uses `eval` which can raise SyntaxError
raise TypeError("data type '{}' not understood".format(dtype))

# Any invalid dtype (such as pd.Timestamp) should raise an error.
Expand Down
2 changes: 1 addition & 1 deletion pandas/io/pytables.py
Original file line number Diff line number Diff line change
Expand Up @@ -1791,7 +1791,7 @@ def convert(self, values, nan_rep, encoding, errors, start=None, stop=None):
# making an Index instance could throw a number of different errors
try:
self.values = Index(values, **kwargs)
except Exception: # noqa: E722
except Exception:

# if the output freq is different that what we recorded,
# it should be None (see also 'doc example part 2')
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/dtypes/test_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,7 +678,7 @@ def test__get_dtype_sparse():
(None, "Cannot deduce dtype from null object"),
(1, "data type not understood"),
(1.2, "data type not understood"),
("random string", "data type 'random string' not understood"),
("random string", 'data type "random string" not understood'),
(pd.DataFrame([1, 2]), "data type not understood"),
],
)
Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/interval/test_astype.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def test_astype_cannot_cast(self, index, dtype):
index.astype(dtype)

def test_astype_invalid_dtype(self, index):
msg = "data type 'fake_dtype' not understood"
msg = 'data type "fake_dtype" not understood'
with pytest.raises(TypeError, match=msg):
index.astype("fake_dtype")

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/indexes/interval/test_construction.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ def test_generic_errors(self, constructor):
constructor(dtype="int64", **filler)

# invalid dtype
msg = "data type 'invalid' not understood"
msg = 'data type "invalid" not understood'
with pytest.raises(TypeError, match=msg):
constructor(dtype="invalid", **filler)

Expand Down
2 changes: 1 addition & 1 deletion pandas/tests/io/parser/test_dtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ def test_invalid_dtype_per_column(all_parsers):
3,4.5
4,5.5"""

with pytest.raises(TypeError, match="data type 'foo' not understood"):
with pytest.raises(TypeError, match='data type "foo" not understood'):
parser.read_csv(StringIO(data), dtype={"one": "foo", 1: "int"})


Expand Down

0 comments on commit a54e1b4

Please sign in to comment.