question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Add dataframe to InfData examples to cookbook

See original GitHub issue

Tell 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:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:9 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
OriolAbrilcommented, Jan 13, 2021

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 and dict 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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found