Skip to content

Commit

Permalink
Fix 'DataFrame' object has no attribute 'ix' (apache#12092)
Browse files Browse the repository at this point in the history
File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 2447, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1952, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1821, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.7/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1950, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.7/site-packages/flask/app.py", line 1936, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.7/site-packages/flask_appbuilder/security/decorators.py", line 109, in wraps
    return f(self, *args, **kwargs)
  File "/app/superset/utils/log.py", line 164, in wrapper
    value = f(*args, **kwargs)
  File "/app/superset/views/core.py", line 2037, in extra_table_metadata
    mydb, table_name, parsed_schema
  File "/app/superset/db_engine_specs/presto.py", line 734, in extra_table_metadata
    table_name, schema_name, database, show_first=True
  File "/usr/local/lib/python3.7/site-packages/flask_caching/__init__.py", line 907, in decorated_function
    rv = f(*args, **kwargs)
  File "/app/superset/db_engine_specs/presto.py", line 977, in latest_partition
    return column_names, cls._latest_partition_from_df(df)
  File "/app/superset/db_engine_specs/hive.py", line 435, in _latest_partition_from_df
    return [df.ix[:, 0].max().split("=")[1]]
  File "/usr/local/lib/python3.7/site-packages/pandas/core/generic.py", line 5139, in __getattr__
    return object.__getattribute__(self, name)
AttributeError: 'DataFrame' object has no attribute 'ix'

Co-authored-by: Ville Brofeldt <[email protected]>
  • Loading branch information
minzhang2110 and villebro authored Nov 15, 2021
1 parent 7f4c240 commit 9741eaa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion superset/db_engine_specs/hive.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ def latest_sub_partition(
def _latest_partition_from_df(cls, df: pd.DataFrame) -> Optional[List[str]]:
"""Hive partitions look like ds={partition name}"""
if not df.empty:
return [df.ix[:, 0].max().split("=")[1]]
return [df.iloc[:, 0].max().split("=")[1]]
return None

@classmethod
Expand Down

0 comments on commit 9741eaa

Please sign in to comment.