Skip to content

Commit

Permalink
STYLE: Using f-strings in pandas/__init__.py (pandas-dev#30475)
Browse files Browse the repository at this point in the history
  • Loading branch information
naomi172839 authored and AlexKirko committed Dec 29, 2019
1 parent 133beee commit 36409c1
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions pandas/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
try:
__import__(dependency)
except ImportError as e:
missing_dependencies.append("{0}: {1}".format(dependency, str(e)))
missing_dependencies.append(f"{dependency}: {e}")

if missing_dependencies:
raise ImportError(
Expand All @@ -33,10 +33,10 @@
# hack but overkill to use re
module = str(e).replace("cannot import name ", "")
raise ImportError(
"C extension: {0} not built. If you want to import "
f"C extension: {module} not built. If you want to import "
"pandas from the source directory, you may need to run "
"'python setup.py build_ext --inplace --force' to build "
"the C extensions first.".format(module)
"the C extensions first."
)

from datetime import datetime
Expand Down Expand Up @@ -213,16 +213,16 @@ class Panel:
return Panel
elif name in {"SparseSeries", "SparseDataFrame"}:
warnings.warn(
"The {} class is removed from pandas. Accessing it from "
f"The {name} class is removed from pandas. Accessing it from "
"the top-level namespace will also be removed in the next "
"version".format(name),
"version",
FutureWarning,
stacklevel=2,
)

return type(name, (), {})

raise AttributeError("module 'pandas' has no attribute '{}'".format(name))
raise AttributeError(f"module 'pandas' has no attribute '{name}'")


else:
Expand Down

0 comments on commit 36409c1

Please sign in to comment.