21
21
cast ,
22
22
overload ,
23
23
)
24
- import warnings
25
24
import zipfile
26
25
27
26
from pandas ._config import config
44
43
Appender ,
45
44
doc ,
46
45
)
47
- from pandas .util ._exceptions import find_stack_level
48
46
49
47
from pandas .core .dtypes .common import (
50
48
is_bool ,
@@ -1136,40 +1134,6 @@ def book(self):
1136
1134
This attribute can be used to access engine-specific features.
1137
1135
"""
1138
1136
1139
- @book .setter
1140
- @abc .abstractmethod
1141
- def book (self , other ) -> None :
1142
- """
1143
- Set book instance. Class type will depend on the engine used.
1144
- """
1145
-
1146
- def write_cells (
1147
- self ,
1148
- cells ,
1149
- sheet_name : str | None = None ,
1150
- startrow : int = 0 ,
1151
- startcol : int = 0 ,
1152
- freeze_panes : tuple [int , int ] | None = None ,
1153
- ) -> None :
1154
- """
1155
- Write given formatted cells into Excel an excel sheet
1156
-
1157
- .. deprecated:: 1.5.0
1158
-
1159
- Parameters
1160
- ----------
1161
- cells : generator
1162
- cell of formatted data to save to Excel sheet
1163
- sheet_name : str, default None
1164
- Name of Excel sheet, if None, then use self.cur_sheet
1165
- startrow : upper left cell row to dump data frame
1166
- startcol : upper left cell column to dump data frame
1167
- freeze_panes: int tuple of length 2
1168
- contains the bottom-most row and right-most column to freeze
1169
- """
1170
- self ._deprecate ("write_cells" )
1171
- return self ._write_cells (cells , sheet_name , startrow , startcol , freeze_panes )
1172
-
1173
1137
@abc .abstractmethod
1174
1138
def _write_cells (
1175
1139
self ,
@@ -1194,15 +1158,6 @@ def _write_cells(
1194
1158
contains the bottom-most row and right-most column to freeze
1195
1159
"""
1196
1160
1197
- def save (self ) -> None :
1198
- """
1199
- Save workbook to disk.
1200
-
1201
- .. deprecated:: 1.5.0
1202
- """
1203
- self ._deprecate ("save" )
1204
- return self ._save ()
1205
-
1206
1161
@abc .abstractmethod
1207
1162
def _save (self ) -> None :
1208
1163
"""
@@ -1232,7 +1187,7 @@ def __init__(
1232
1187
# the excel backend first read the existing file and then write any data to it
1233
1188
mode = mode .replace ("a" , "r+" )
1234
1189
1235
- # cast ExcelWriter to avoid adding 'if self.handles is not None'
1190
+ # cast ExcelWriter to avoid adding 'if self._handles is not None'
1236
1191
self ._handles = IOHandles (
1237
1192
cast (IO [bytes ], path ), compression = {"compression" : None }
1238
1193
)
@@ -1264,29 +1219,6 @@ def __init__(
1264
1219
if_sheet_exists = "error"
1265
1220
self ._if_sheet_exists = if_sheet_exists
1266
1221
1267
- def _deprecate (self , attr : str ) -> None :
1268
- """
1269
- Deprecate attribute or method for ExcelWriter.
1270
- """
1271
- warnings .warn (
1272
- f"{ attr } is not part of the public API, usage can give unexpected "
1273
- "results and will be removed in a future version" ,
1274
- FutureWarning ,
1275
- stacklevel = find_stack_level (),
1276
- )
1277
-
1278
- def _deprecate_set_book (self ) -> None :
1279
- """
1280
- Deprecate setting the book attribute - GH#48780.
1281
- """
1282
- warnings .warn (
1283
- "Setting the `book` attribute is not part of the public API, "
1284
- "usage can give unexpected or corrupted results and will be "
1285
- "removed in a future version" ,
1286
- FutureWarning ,
1287
- stacklevel = find_stack_level (),
1288
- )
1289
-
1290
1222
@property
1291
1223
def date_format (self ) -> str :
1292
1224
"""
@@ -1308,36 +1240,6 @@ def if_sheet_exists(self) -> str:
1308
1240
"""
1309
1241
return self ._if_sheet_exists
1310
1242
1311
- @property
1312
- def cur_sheet (self ):
1313
- """
1314
- Current sheet for writing.
1315
-
1316
- .. deprecated:: 1.5.0
1317
- """
1318
- self ._deprecate ("cur_sheet" )
1319
- return self ._cur_sheet
1320
-
1321
- @property
1322
- def handles (self ) -> IOHandles [bytes ]:
1323
- """
1324
- Handles to Excel sheets.
1325
-
1326
- .. deprecated:: 1.5.0
1327
- """
1328
- self ._deprecate ("handles" )
1329
- return self ._handles
1330
-
1331
- @property
1332
- def path (self ):
1333
- """
1334
- Path to Excel file.
1335
-
1336
- .. deprecated:: 1.5.0
1337
- """
1338
- self ._deprecate ("path" )
1339
- return self ._path
1340
-
1341
1243
def __fspath__ (self ) -> str :
1342
1244
return getattr (self ._handles .handle , "name" , "" )
1343
1245
0 commit comments