Skip to content
Prev Previous commit
Next Next commit
raising if to_ method exists
  • Loading branch information
datapythonista committed May 22, 2023
commit 000ea21adfba4f5c7a91260a1c16bb1f8da9b048
8 changes: 7 additions & 1 deletion pandas/io/_plugin_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def load_io_plugins():
raise RuntimeError(
"More than one installed library provides the "
"`read_{format_name}` reader. Please uninstall one of "
"the I/O plugins to be able to load the pandas I/O plugins."
"the I/O plugins providing connectors for this format."
)
setattr(
pd,
Expand All @@ -136,6 +136,12 @@ def load_io_plugins():
)

if hasattr(io_plugin, f"{exchange_format}_writer"):
if hasattr(pd.DataFrame, f"to_{format_name}"):
raise RuntimeError(
"More than one installed library provides the "
"`to_{format_name}` reader. Please uninstall one of "
"the I/O plugins providing connectors for this format."
)
setattr(
pd.DataFrame,
f"to_{format_name}",
Expand Down