1

I've ran a bayesian model using pymc and drew a sample of 1,000 values across six chains for 1774 observations. This resulted in an array with shape (6, 1000, 1774). I need the mean sampled value for each 1774 observations. So in essenace, the mean of each chain, and each 1000 samples for each 1774 observations.

if x = array (6,1000,1774).

I need to add the mean values to my dataframe with a length of 1774 as another column.

Using fake data,

import numpy as np

x = np.random.rand(6,1000,1774)

Running:

x.mean(axis = 0) gives shape(1000, 1774)

How do I do this correctly?

0

1 Answer 1

2

pass multiple axes as a tuple:

x.mean(axis=(0,1))
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.