Add dataframe to InfData examples to cookbook
See original GitHub issueTell us about it
Add dataframe to InfData examples to cookbook
https://arviz-devs.github.io/arviz/getting_started/InferenceDataCookbook.html?highlight=cookbook
import pandas as pd
import xarray as xr
import arviz as az
import numpy as np
df = Datasets.Waterbury.to_dataframe()
df["chain"] = 1
df["draw"] = np.arange(len(df), dtype=int)
df = df.set_index(["chain", "draw"])
xdata = xr.Dataset.from_dataframe(df)
idata = az.InferenceData(posterior=xdata)
Issue Analytics
- State:
- Created 3 years ago
- Reactions:1
- Comments:9 (7 by maintainers)
Top Results From Across the Web
Cookbook — pandas 1.5.2 documentation
This is a repository for short and sweet examples and links for useful pandas recipes. We encourage users to add to this documentation....
Read more >Cookbook — pandas 2.0.0.dev0+922.gbf5ee72d5b ...
This is a repository for short and sweet examples and links for useful pandas recipes. We encourage users to add to this documentation....
Read more >Cookbook — pandas 0.16.1 documentation
This is a repository for short and sweet examples and links for useful pandas recipes. We encourage users to add to this documentation....
Read more >Cookbook — pandas 1.2.5 documentation
This is a repository for short and sweet examples and links for useful pandas recipes. We encourage users to add to this documentation....
Read more >Cookbook — pandas 0.25.3 documentation
Adding interesting links and/or inline examples to this section is a great First Pull ... DataFrame(data=data, index=[1, 2, 3, 4]) # Note index...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
True, we renamed it recently: https://github.com/arviz-devs/arviz/blob/main/doc/source/getting_started/CreatingInferenceData.ipynb
Hi @shivam5522, welcome!
The cookbook page in the docs is generated from a jupyter notebook that you can find at https://github.com/arviz-devs/arviz/blob/master/doc/source/getting_started/InferenceDataCookbook.ipynb. The idea of this issue is to follow the pattern of
np.ndarray
anddict
and add a couple cells to the notebook (between the dict and pymc3 examples) and add a variation of the code above to show how to generate an InferenceData from a pandas dataframe.