Skip to content
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

fix: 'DataFrame' object has no attribute 'ix' #12092

Merged
merged 2 commits into from
Nov 15, 2021

Conversation

minzhang2110
Copy link
Contributor

@minzhang2110 minzhang2110 commented Dec 17, 2020

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_functionsrule.endpoint
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'

SUMMARY

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

TEST PLAN

ADDITIONAL INFORMATION

  • Has associated issue:
  • Changes UI
  • Requires DB Migration.
  • Confirm DB Migration upgrade and downgrade tested.
  • Introduces new feature or API
  • Removes existing feature or API

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'
@codecov-io
Copy link

codecov-io commented Dec 17, 2020

Codecov Report

Merging #12092 (57e9531) into master (5d3e1b5) will increase coverage by 5.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #12092      +/-   ##
==========================================
+ Coverage   77.04%   82.05%   +5.00%     
==========================================
  Files        1041      362     -679     
  Lines       56068    29112   -26956     
  Branches     7742        0    -7742     
==========================================
- Hits        43198    23888   -19310     
+ Misses      12612     5224    -7388     
+ Partials      258        0     -258     
Flag Coverage Δ
hive ?
javascript ?
mysql 81.95% <0.00%> (+<0.01%) ⬆️
postgres 81.96% <0.00%> (+0.01%) ⬆️
presto ?
python 82.05% <0.00%> (-0.41%) ⬇️
sqlite 81.64% <0.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
superset/db_engine_specs/hive.py 69.49% <0.00%> (-16.99%) ⬇️
superset/db_engines/hive.py 0.00% <0.00%> (-85.19%) ⬇️
superset/db_engine_specs/presto.py 83.47% <0.00%> (-6.49%) ⬇️
superset/views/database/mixins.py 81.03% <0.00%> (-1.73%) ⬇️
superset/connectors/sqla/models.py 86.79% <0.00%> (-1.43%) ⬇️
superset/models/core.py 89.26% <0.00%> (-0.74%) ⬇️
superset/db_engine_specs/base.py 88.20% <0.00%> (-0.39%) ⬇️
superset/utils/core.py 89.61% <0.00%> (-0.36%) ⬇️
superset/charts/schemas.py 100.00% <0.00%> (ø)
... and 684 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5d3e1b5...57e9531. Read the comment docs.

@stale
Copy link

stale bot commented Jun 26, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. For admin, please label this issue .pinned to prevent stale bot from closing the issue.

@stale stale bot added the inactive Inactive for >= 30 days label Jun 26, 2021
@stale stale bot removed the inactive Inactive for >= 30 days label Nov 15, 2021
Copy link
Member

@villebro villebro left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - thanks so much for fixing this!

@villebro villebro changed the title Fix 'DataFrame' object has no attribute 'ix' fix: 'DataFrame' object has no attribute 'ix' Nov 15, 2021
@villebro
Copy link
Member

@minzhang2110 apologies for this having been buried in the PR backlog. I rebased the PR and will merge once CI passes.

@villebro
Copy link
Member

For additional context, ix indexing was deprecated in Pandas 0.20 and removed in 1.0: http://pandas-docs.github.io/pandas-docs-travis/user_guide/indexing.html#ix-indexer-is-deprecated

@villebro villebro merged commit 9741eaa into apache:master Nov 15, 2021
AAfghahi pushed a commit that referenced this pull request Jan 10, 2022
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 <ville.v.brofeldt@gmail.com>
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.0 labels Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/XS 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants