Skip to content

Commit

Permalink
Fixed pandas bug
Browse files Browse the repository at this point in the history
  • Loading branch information
roll committed Oct 14, 2020
1 parent 8d5b51d commit b97ed44
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions frictionless/plugins/pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,22 @@ class PandasPlugin(Plugin):
"""

def create_dialect(self, resource, *, descriptor):
pd = helpers.import_from_plugin("pandas", plugin="pandas")
if resource.format == "pandas" or isinstance(resource.source, pd.DataFrame):
return PandasDialect(descriptor)
try:
# TODO: cannot be loaded with plugins; improve this solution
pd = helpers.import_from_plugin("pandas", plugin="pandas")
if resource.format == "pandas" or isinstance(resource.source, pd.DataFrame):
return PandasDialect(descriptor)
except Exception:
pass

def create_parser(self, resource):
pd = helpers.import_from_plugin("pandas", plugin="pandas")
if resource.format == "pandas" or isinstance(resource.source, pd.DataFrame):
return PandasParser(resource)
try:
# TODO: cannot be loaded with plugins; improve this solution
pd = helpers.import_from_plugin("pandas", plugin="pandas")
if resource.format == "pandas" or isinstance(resource.source, pd.DataFrame):
return PandasParser(resource)
except Exception:
pass

def create_storage(self, name, **options):
if name == "pandas":
Expand Down

0 comments on commit b97ed44

Please sign in to comment.