File tree Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Expand file tree Collapse file tree 1 file changed +7
-5
lines changed Original file line number Diff line number Diff line change 182182 Window ,
183183)
184184
185- # Import ExcelFormatter at runtime since it's used in to_excel method
186- from pandas .io .formats .excel import ExcelFormatter
187185from pandas .io .formats .format import (
188186 DataFrameFormatter ,
189187 DataFrameRenderer ,
204202
205203 from pandas import (
206204 DataFrame ,
205+ ExcelWriter ,
207206 HDFStore ,
208207 Series ,
209208 )
210209 from pandas .core .indexers .objects import BaseIndexer
211210 from pandas .core .resample import Resampler
212211
213- # Import ExcelWriter at runtime since it's used in to_excel method
214212import textwrap
215213
216- from pandas import ExcelWriter
217-
218214# goal is to be able to define the docs close to function, while still being
219215# able to share
220216_shared_docs = {** _shared_docs }
@@ -2275,6 +2271,9 @@ def to_excel(
22752271 >>> df.to_excel("pandas_simple.xlsx")
22762272 >>> df.to_excel("pandas_simple.xlsx", engine="openpyxl")
22772273 """
2274+ # Import ExcelWriter here to avoid circular import
2275+ from pandas import ExcelWriter
2276+
22782277 if isinstance (excel_writer , ExcelWriter ):
22792278 if engine is not None :
22802279 raise ValueError (
@@ -2289,6 +2288,9 @@ def to_excel(
22892288 storage_options = storage_options ,
22902289 )
22912290
2291+ # Import ExcelFormatter here to avoid circular import
2292+ from pandas .io .formats .excel import ExcelFormatter
2293+
22922294 formatter = ExcelFormatter (
22932295 self ,
22942296 na_rep = na_rep ,
You can’t perform that action at this time.
0 commit comments