I am new in the Stackoverflow environment and i am trying to sort/create arrays so that i can work with these arrays. I am trying to get the mean and std.
I have a data set of almost 50.000 observations.
An example of the dataset is shown below.
| Person | Product | Date | Price |
|----------|---------|------------|-------|
| Chris | Pear | 01-02-2018 | 10 |
| Tom | Pear | 02-02-2018 | 11 |
| John | Pear | 03-02-2018 | 12 |
| Bill | Pear | 04-02-2018 | 13 |
| Someone | Pear | 05-02-2018 | 14 |
| Chris | Pear | 06-02-2018 | 15 |
| Tom2 | Apples | 07-02-2018 | 16 |
| John | Pear | 08-02-2018 | 17 |
| Bill2 | Pear | 09-02-2018 | 18 |
| Someone2 | Pear | 10-02-2018 | 19 |
Mean price: 14.5
STD:3.028
What I want to have is an array (FOR each of the prices) so i would know what the mean price and std. were at the current date. That would give me only the most recent observation, based on the criteria: Person, Product
So I would end up with something like this (for Pears) at the date 10-02-2018:
+----------+---------+------------+-------+
| Person | Product | Date | Price |
+----------+---------+------------+-------+
| Tom | Pear | 02-02-2018 | 11 |
+----------+---------+------------+-------+
| Bill | Pear | 04-02-2018 | 13 |
+----------+---------+------------+-------+
| Someone | Pear | 05-02-2018 | 14 |
+----------+---------+------------+-------+
| Chris | Pear | 06-02-2018 | 15 |
+----------+---------+------------+-------+
| John | Pear | 08-02-2018 | 17 |
+----------+---------+------------+-------+
| Bill2 | Pear | 09-02-2018 | 18 |
+----------+---------+------------+-------+
| Someone2 | Pear | 10-02-2018 | 19 |
+----------+---------+------------+-------+
Mean price: 15.29
Std: 2.87
Hope that some is able to help out!
In advance many many thanks.