Skip to content

Infer dims & coords from xarray variables passed to pm.Data #5796

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

Closed
wants to merge 1 commit into from

Conversation

mjhajharia
Copy link
Member

@mjhajharia mjhajharia commented May 24, 2022

addresses #5791

  • Inferring dims from named pandas indexes
  • Inferring dims from DataArrays
  • Inferring coords from DataArrays
  • A unit test
  • Possibly a (backwards compatible with deprecation warning) rename of the export_index_as_coords to infer_dims_and_coords.

cc: @michaelosthege (I might have made errors, also I just emulated the pandas code for xarray, not sure if it makes sense)

Copy link
Member

@michaelosthege michaelosthege left a comment

Choose a reason for hiding this comment

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

sorry @mjhajharia, I forgot to submit the review commend I made a few days ago 🙈

It looks like there's a block of code that got duplicated?

@@ -485,6 +485,8 @@ def determine_coords(
dim_name = value.index.name
if dim_name is not None:
coords[dim_name] = value.index
if dims is None:
dims = dims_name
Copy link
Member

Choose a reason for hiding this comment

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

dims should be a list

In addition, it might be a good idea to account for the case of Multi-Indexed DataFrames. (raise?)

@ricardoV94
Copy link
Member

Is this PR salvageable or should we close it?

@michaelosthege
Copy link
Member

michaelosthege commented Mar 16, 2023

Actually this was continued & completed in #6514, so we can close

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants