Skip to content

Commit e7e9745

Browse files
a2435191feefladder
authored andcommitted
CLN str.replace -> .name attribute for ImportError (pandas-dev#43013)
Co-authored-by: Jim Bradley <[email protected]>
1 parent 88a05af commit e7e9745

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

pandas/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,7 @@
2424
try:
2525
from pandas._libs import hashtable as _hashtable, lib as _lib, tslib as _tslib
2626
except ImportError as e: # pragma: no cover
27-
# hack but overkill to use re
28-
module = str(e).replace("cannot import name ", "")
27+
module = e.name
2928
raise ImportError(
3029
f"C extension: {module} not built. If you want to import "
3130
"pandas from the source directory, you may need to run "

0 commit comments

Comments
 (0)