Skip to content

how to get a pandas dataframe of ds.data_vars? #5309

Answered by keewis
raybellwaves asked this question in Q&A
Discussion options

You must be logged in to vote

I don't think we have anything like that, yet. For reference, it's much easier to compute all at once:

In [10]: ds = xr.tutorial.open_dataset("eraint_uvz")
    ...: pd.DataFrame(
    ...:     [[name, var.dims] for name, var in ds.data_vars.items()],
    ...:     columns=["Data Variable", "Dimensions"],
    ...: )
Out[10]: 
  Data Variable                           Dimensions
0             z  (month, level, latitude, longitude)
1             u  (month, level, latitude, longitude)
2             v  (month, level, latitude, longitude)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by raybellwaves
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants