Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STYLE: Using f-strings in pandas/__init__.py #30475

Merged
merged 2 commits into from
Dec 26, 2019
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}: {str(e)}")
naomi172839 marked this conversation as resolved.
Show resolved Hide resolved

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