8000 Excel Reader Refactor - Base Class Introduction by WillAyd · Pull Request #24829 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

Excel Reader Refactor - Base Class Introduction #24829

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

Merged
merged 9 commits into from
Jan 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
Prev Previous commit
Next Next commit
Used ABC metaclass
  • Loading branch information
WillAyd committed Jan 24, 2019
commit a154cf3b85c90fc6935bd333520611d2d1d062bc
15 changes: 10 additions & 5 deletions pandas/io/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
import pandas.compat as compat
from pandas.compat import (
OrderedDict, add_metaclass, lrange, map, range, string_types, u, zip)
from pandas.errors import AbstractMethodError, EmptyDataError
from pandas.errors import EmptyDataError
from pandas.util._decorators import Appender, deprecate_kwarg

from pandas.core.dtypes.common import (
Expand Down Expand Up @@ -375,20 +375,25 @@ def read_excel(io,
**kwds)


@add_metaclass(abc.ABCMeta)
class _BaseExcelReader(object):

@property
@abc.abstractmethod
def sheet_names(self):
raise AbstractMethodError
pass

@abc.abstractmethod
def get_sheet_by_name(self, name):
raise AbstractMethodError
pass

@abc.abstractmethod
def get_sheet_by_index(self, index):
raise AbstractMethodError
pass

@abc.abstractmethod
def get_sheet_data(self, sheet, convert_float):
raise AbstractMethodError
pass

def parse(self,
sheet_name=0,
Expand Down
0