html_url,issue_url,id,node_id,user,created_at,updated_at,author_association,body,reactions,performed_via_github_app,issue https://github.com/pydata/xarray/pull/2073#issuecomment-383364259,https://api.github.com/repos/pydata/xarray/issues/2073,383364259,MDEyOklzc3VlQ29tbWVudDM4MzM2NDI1OQ==,16351486,2018-04-22T08:21:20Z,2018-04-22T08:21:20Z,NONE,"When I am a novice, I want to convert multidimensional data of ```pd.Dataframe``` into ```xr.Dataset```. The 'Multi-dimensional data' section is found from the 'Working with pandas' chapter. Then, I skipping the other to this section. this example showed that Xarray is not good at Multi-dimensional data until i discovered ```xr.Dataset.from_dataframe``` i know the mean of the leading paragraph, but it may be obstacles in this the 'Multi-dimensional data' section for novices.","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,316540429 https://github.com/pydata/xarray/pull/2073#issuecomment-383350237,https://api.github.com/repos/pydata/xarray/issues/2073,383350237,MDEyOklzc3VlQ29tbWVudDM4MzM1MDIzNw==,16351486,2018-04-22T02:24:17Z,2018-04-22T02:58:49Z,NONE," No, these should not An example --- ```python # creat dataframe index = pd.MultiIndex.from_arrays([['a', 'a', 'b'], [0, 1, 2]], names=['one', 'two']) df = pd.DataFrame({'x': 1, 'y': 2}, index=index) # display df ```
x y
one two
a 0 1 2
1 1 2
b 2 1 2
--- ```python # use xr.Dataset transform xr.Dataset(df) ``` Dimensions: (dim_0: 3) Coordinates: * dim_0 (dim_0) MultiIndex - one (dim_0) object 'a' 'a' 'b' - two (dim_0) int64 0 1 2 Data variables: x (dim_0) int64 1 1 1 y (dim_0) int64 2 2 2 --- ```python # use xr.Dataset.from_dataframe transform xr.Dataset.from_dataframe(df) ``` Dimensions: (one: 2, two: 3) Coordinates: * one (one) object 'a' 'b' * two (two) int64 0 1 2 Data variables: x (one, two) float64 1.0 1.0 nan nan nan 1.0 y (one, two) float64 2.0 2.0 nan nan nan 2.0 --- From the above example,```xr.Dataset.from_dataframe``` is a better representation of the coordinate than ```xr.Dataset```from pandas.dataframe ","{""total_count"": 0, ""+1"": 0, ""-1"": 0, ""laugh"": 0, ""hooray"": 0, ""confused"": 0, ""heart"": 0, ""rocket"": 0, ""eyes"": 0}",,316540429