问:
nginx-ingress config map snippets being ignored by the nginx.conf
I have a kubernetes cluster, where I have deployed an nginx ingress controller using the helm nginx-ingress chart.

I need to add some custom config to the nginx.conf file that is generated in the nginx-controller-pod, and I am seeing an issue where if I add a one line option such as proxy-buffer-size: "512k" I can see this reflected in the nginx.conf file and everything works as expected.

However, if I attempt to add a snippet to accomplish the same thing:

```<code>location-snippet: |
  proxy_buffer_size "512k";
</code>```

It is as though this is ignored by the nginx.conf file and the proxy_buffer_size setting remains at it's default value.

I need to be able to add http-snippet, server-snippet and location-snippet overrides but whether I try to add them to the ConfigMap or as an annotation in the Ingress.yaml file they are always ignored.

My Ingress yaml file:

```<code>apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    ingress.kubernetes.io/ssl-redirect: "true"
    ingress.kubernetes.io/secure-backends: "true"
    ingress.kubernetes.io/force-ssl-redirect: "true"

    ingress.kubernetes.io/location-snippet: |
       proxy_buffer_size 512k;     --This does not update the nginx.conf
spec:
  tls:
  - hosts:
    - my.app.co.uk
    secretName: tls-secret

  rules:
  - host: my.app.co.uk
    http:
      paths:
      - path: /
        backend:
          serviceName: myappweb-service
          servicePort: 80
</code>```

My nginx config map:

```<code>apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    app: nginx-ingress
    chart: nginx-ingress-0.28.3
    component: controller
    heritage: Tiller
    release: nginx-ingress
  name: nginx-ingress-controller
  namespace: default
data:
  proxy-buffer-size: "512k" -- this works and updates the nginx.conf

  location-snippet: |
    proxy_buffers 4 512k; -- this does not update the nginx.conf

  server-snippet: |       -- this does not update the nginx.conf
    location /messagehub {
      proxy_set_header Upgrade $http_upgrade;
      proxy_http_version 1.1;
      proxy_set_header X-Forwarded-Host $http_host;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_set_header Host $host;
      proxy_set_header Connection "upgrade";
      proxy_cache_bypass $http_upgrade;
   }
</code>```

答: If some needs solution for Kubernetes 1.23 and Helm 3, here is my answer in the similar topic.</p>

Body:
I have a kubernetes cluster, where I have deployed an nginx ingress controller using the helm nginx-ingress chart.

I need to add some custom config to the nginx.conf file that is generated in the nginx-controller-pod, and I am seeing an issue where if I add a one line option such as proxy-buffer-size: "512k" I can see this reflected in the nginx.conf file and everything works as expected.

However, if I attempt to add a snippet to accomplish the same thing:

location-snippet: |
  proxy_buffer_size "512k";

It is as though this is ignored by the nginx.conf file and the proxy_buffer_size setting remains at it's default value.

I need to be able to add http-snippet, server-snippet and location-snippet overrides but whether I try to add them to the ConfigMap or as an annotation in the Ingress.yaml file they are always ignored.

My Ingress yaml file:

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  name: my-ingress
  annotations:
    kubernetes.io/ingress.class: nginx
    ingress.kubernetes.io/ssl-redirect: "true"
    ingress.kubernetes.io/secure-backends: "true"
    ingress.kubernetes.io/force-ssl-redirect: "true"

    ingress.kubernetes.io/location-snippet: |
       proxy_buffer_size 512k;     --This does not update the nginx.conf
spec:
  tls:
  - hosts:
    - my.app.co.uk
    secretName: tls-secret

  rules:
  - host: my.app.co.uk
    http:
      paths:
      - path: /
        backend:
          serviceName: myappweb-service
          servicePort: 80

My nginx config map:

apiVersion: v1
kind: ConfigMap
metadata:
  labels:
    app: nginx-ingress
    chart: nginx-ingress-0.28.3
    component: controller
    heritage: Tiller
    release: nginx-ingress
  name: nginx-ingress-controller
  namespace: default
data:
  proxy-buffer-size: "512k" -- this works and updates the nginx.conf

  location-snippet: |
    proxy_buffers 4 512k; -- this does not update the nginx.conf

  server-snippet: |       -- this does not update the nginx.conf
    location /messagehub {
      proxy_set_header Upgrade $http_upgrade;
      proxy_http_version 1.1;
      proxy_set_header X-Forwarded-Host $http_host;
      proxy_set_header X-Forwarded-Proto $scheme;
      proxy_set_header X-Forwarded-For $remote_addr;
      proxy_set_header Host $host;
      proxy_set_header Connection "upgrade";
      proxy_cache_bypass $http_upgrade;
   }


来源: stackexchange

问:
Gitlab pipeline - instead of 1, 2 are running
I would like to add to Gitlab pipeline a stage which verifies that the person approving the MR is different from the person doing the creation/merge (for this to work, I checked the setting in Gitlab that says: "Pipelines must succeed").

```<code>stages:
  - quality

...

check-approval:
  stage: quality
  only:
    - merge_request
  script:
    - >
      author=$(curl -s --location --request POST 'https://xxxxx.com/api/graphql' --header 'Content-Type: application/json' --header "JOB-TOKEN: $CI_JOB_TOKEN" --data-raw '{"query":"query{project(fullPath: \"yyyyy/yyyyy/yyyyy\") {mergeRequest(iid:\"'$CI_MERGE_REQUEST_IID'\"){approvedBy{nodes{name}}author{name}}}}"}' | jq '.data.project.mergeRequest.author.name')
    - >
      approvedBy=$(curl -s --location --request POST 'https://xxxxx.com/api/graphql' --header 'Content-Type: application/json' --header "JOB-TOKEN: $CI_JOB_TOKEN" --data-raw '{"query":"query{project(fullPath: \"yyyyy/yyyyy/yyyyy\") {mergeRequest(iid:\"'$CI_MERGE_REQUEST_IID'\"){approvedBy{nodes{name}}author{name}}}}"}' | jq '.data.project.mergeRequest.approvedBy.nodes[].name')
    - if [[ "$author" == "$approvedBy" ]]; then exit 1; else echo "MR can be merged"; fi
</code>```

However, because I add the item only: - merge_request, there are two pipelines running (branch + merge) in parallel.

My questions are:

how can I make the branch pipeline also run in the merge pipeline?

is there any way to only run the stage of the pipeline that gave an error?

答:
To avoid duplicate pipelines:

workflow:
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    - if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
      when: never # skip branch pipelines when MR is open for this ref
    - if: '$CI_COMMIT_BRANCH' # run branch pipelines if MR is not open on this ref
```

This way, you'll still get merge request pipelines, and also get branch pipelines, but only when an MR pipeline is not created, avoiding duplicate pipelines on MRs.

is there any way to only run the stage of the pipeline that gave an error?

You can use the "retry" button on the pipeline view, which will retry any failed jobs and allow the pipeline to progress if they succeed on retry. Already successful jobs will not be retried.

ContentLicense: CC BY-SA 4.0

Body:
I would like to add to Gitlab pipeline a stage which verifies that the person approving the MR is different from the person doing the creation/merge (for this to work, I checked the setting in Gitlab that says: "Pipelines must succeed").

stages:
  - quality

...

check-approval:
  stage: quality
  only:
    - merge_request
  script:
    - >
      author=$(curl -s --location --request POST 'https://xxxxx.com/api/graphql' --header 'Content-Type: application/json' --header "JOB-TOKEN: $CI_JOB_TOKEN" --data-raw '{"query":"query{project(fullPath: \"yyyyy/yyyyy/yyyyy\") {mergeRequest(iid:\"'$CI_MERGE_REQUEST_IID'\"){approvedBy{nodes{name}}author{name}}}}"}' | jq '.data.project.mergeRequest.author.name')
    - >
      approvedBy=$(curl -s --location --request POST 'https://xxxxx.com/api/graphql' --header 'Content-Type: application/json' --header "JOB-TOKEN: $CI_JOB_TOKEN" --data-raw '{"query":"query{project(fullPath: \"yyyyy/yyyyy/yyyyy\") {mergeRequest(iid:\"'$CI_MERGE_REQUEST_IID'\"){approvedBy{nodes{name}}author{name}}}}"}' | jq '.data.project.mergeRequest.approvedBy.nodes[].name')
    - if [[ "$author" == "$approvedBy" ]]; then exit 1; else echo "MR can be merged"; fi

However, because I add the item only: - merge_request, there are two pipelines running (branch + merge) in parallel.

My questions are:

how can I make the branch pipeline also run in the merge pipeline?

is there any way to only run the stage of the pipeline that gave an error?

Body:
To avoid duplicate pipelines:

workflow:
  rules:
    - if: '$CI_PIPELINE_SOURCE == "merge_request_event"'
    - if: '$CI_COMMIT_BRANCH && $CI_OPEN_MERGE_REQUESTS'
      when: never # skip branch pipelines when MR is open for this ref
    - if: '$CI_COMMIT_BRANCH' # run branch pipelines if MR is not open on this ref

This way, you'll still get merge request pipelines, and also get branch pipelines, but only when an MR pipeline is not created, avoiding duplicate pipelines on MRs.

is there any way to only run the stage of the pipeline that gave an error?

You can use the "retry" button on the pipeline view, which will retry any failed jobs and allow the pipeline to progress if they succeed on retry. Already successful jobs will not be retried.


问:
Cannot click or select span elements, after a canvas is focused in HTML - debugging?
I don't often work with HTML these days, and I'm working with some JS libraries that manipulate canvas. I got done all that I needed - but I just realized, that

When the webpage starts, all text is selectable (titles, subtitles, notifications etc - basically all text in spans and divs)

Then, I typically click on the canvas and interact with it

But, if after clicking the canvas, I try to go to, say, the title span, and click on it to select - the text is not selectable anymore (and no text on the webpage is anymore, apart from text form inputs)

So, I tried looking into this, and found:

HTML input fields does not get focus when clicked

The root cause of the problem is disableSelection(). It is causing all the problems, but removing it is not a solution, as (at least in 2016 or slightly before), on touch-screen devices, you "have" to use this if you want to be able to move objects with jQuery.

So, disableSelection is apparently jQuery, but so far I have just used vanilla javascript in my project (I think, but some of the libraries I use might use jQuery).

Anyways, I thought - before I try to blindly copy/paste online code, in an attempt to restore selectability, - could I somehow confirm through the DOM inspector in the browser, that an element is selectable or not? Say, here is how my Firefox Inspector form Web Developer Tools looks like:

Is there something accessible in the Inspector, like a CSS property, to tell me if an object is selectable? If not, can I quickly run a JavaScript one-liner in the browser Console, and find out the selectability status of an element?

答:
OK, thanks to the comment of @burkay, I got it - indeed, it is about user-select. So, in Firefox,

right-click on an element then choose Inspect Element, then

Right-click on the entry (corresponding to this element, autoselected) in the Inspector, and choose "Use in Console"

Then you will get a temp1 variable in Console, which you can query:

Note that CSS properties end up as properties of .style property of the element, however their names do not include hyphens anymore, but are instead CamelCase - so for user-select in CSS file, we have .style.userSelect in Console. (also, note that .mozUserSelect tracks/copies the values of userSelect)

Above is the log that I got for my problem; at start, the object has .style.userSelect set to empty string, and it is unselectable; then I tried setting it to "auto", and it remained unselectable; finally I set it to "text" - and at that point, the text became selectable (credit to @RaduSimionescu)


问:
Linear regression in Numpy that takes account of data point standard deviations
Importing the libraries needed:

```<code>import matplotlib.pyplot as plt
import numpy as np
</code>```

I have the df

```<code>volfit=pd.DataFrame({'Osmolarity':[100,200,300,400,600,800],'avgvol':[1.27,1.06,1,0.92,0.84,0.74],'stdev':[0.132,0.053,0,0.037,0.040,0.077]})
</code>```

fitting the data below:

```<code>p,cov=np.polyfit(volfit['Osmolarity'], volfit['avgvol'],1,cov=True)
slope=p[0]
intercept=p[1]
std_err=np.sqrt(np.diag(cov))
slope_std_err= std_err[0]
int_std_err = std_err[1]
</code>```

plotting the fit below:

```<code>fig,ax=plt.subplots(1,1,figsize=(5,4))
plt.scatter(volfit['Osmolarity'], volfit['avgvol'],color="black")
plt.plot(volfit['Osmolarity'],np.polyval(p,volfit['Osmolarity']),color='red')
plt.errorbar(volfit['Osmolarity'], volfit['avgvol'],yerr=volfit['stdev'],ls='none',color='black')
plt.title('y={:.4f}x + {:.1f} \nslope \u03C3 \u00B1 {:.4f} \n  b-int \u03C3 \u00B1 {:.2f}'.format(slope, intercept,slope_std_err,int_std_err),size=18,horizontalalignment='center',x=0.6, y=0.6)
ax.set_xlabel("\u03A0 (mOsm)",size=18)
ax.set_ylabel(r'Cell Volume Change ($\tilde{v}$)',size=18)
</code>```

And I get this plot . What I want to do is use the standard deviations to force the polyfit to consider the points with the lowest standard deviations more than the ones with the really high standard deviations. So I would want the plot to look like  this where it crosses through (300,1) because it has the an stdev of 0.

答:
Just use the kwarg w = weights. Then you have to choose how you want your weights to depend on the standard deviation, a simple choice would be

```<code>coeff, cov = np.polyfit(x, y, 1, cov=True, w=(1/sigma))
</code>```

Such that the weight is inversely proportional to the standard deviation, then set the std. dev. of (300, 1) to 1e-16 or some other small, non-zero number.

Edit: A quite common "hack" to use if you have a single point that you know that your fit has to pass through to be physically meaningful is to just add a bunch of points there. That is: Just add 100 or 1000 or some large enough number of copies of the point at (300, 1) to the data-set to force it to go through that point.

Body:
Importing the libraries needed:

import matplotlib.pyplot as plt
import numpy as np

I have the df

volfit=pd.DataFrame({'Osmolarity':[100,200,300,400,600,800],'avgvol':[1.27,1.06,1,0.92,0.84,0.74],'stdev':[0.132,0.053,0,0.037,0.040,0.077]})

fitting the data below:

p,cov=np.polyfit(volfit['Osmolarity'], volfit['avgvol'],1,cov=True)
slope=p[0]
intercept=p[1]
std_err=np.sqrt(np.diag(cov))
slope_std_err= std_err[0]
int_std_err = std_err[1]

plotting the fit below:

fig,ax=plt.subplots(1,1,figsize=(5,4))
plt.scatter(volfit['Osmolarity'], volfit['avgvol'],color="black")
plt.plot(volfit['Osmolarity'],np.polyval(p,volfit['Osmolarity']),color='red')
plt.errorbar(volfit['Osmolarity'], volfit['avgvol'],yerr=volfit['stdev'],ls='none',color='black')
plt.title('y={:.4f}x + {:.1f} \nslope \u03C3 \u00B1 {:.4f} \n  b-int \u03C3 \u00B1 {:.2f}'.format(slope, intercept,slope_std_err,int_std_err),size=18,horizontalalignment='center',x=0.6, y=0.6)
ax.set_xlabel("\u03A0 (mOsm)",size=18)
ax.set_ylabel(r'Cell Volume Change ($\tilde{v}$)',size=18)

And I get this plot . What I want to do is use the standard deviations to force the polyfit to consider the points with the lowest standard deviations more than the ones with the really high standard deviations. So I would want the plot to look like  this where it crosses through (300,1) because it has the an stdev of 0.

Body:
Just use the kwarg w = weights. Then you have to choose how you want your weights to depend on the standard deviation, a simple choice would be

coeff, cov = np.polyfit(x, y, 1, cov=True, w=(1/sigma))

Such that the weight is inversely proportional to the standard deviation, then set the std. dev. of (300, 1) to 1e-16 or some other small, non-zero number.

Edit: A quite common "hack" to use if you have a single point that you know that your fit has to pass through to be physically meaningful is to just add a bunch of points there. That is: Just add 100 or 1000 or some large enough number of copies of the point at (300, 1) to the data-set to force it to go through that point.


问:
Remove certain words from URL
I scraped tweet statuses, from which I'm removing certain words; however, it doesn't work effectively as it only removes the first string in "stopwords".

Code:

```<code>stopwords = ['/people', '/photo/1']
link_list = []
for link in links:
    for i in stopwords:
        remove = link.replace(i, "")
        link = remove
        link_list.append(link)
</code>```

Output:

```<code>https://twitter.com/CultOfCurtis/status/1492292326051483648
https://twitter.com/ZBumblenuts/status/1492292306149560321
https://twitter.com/AndreWillemse4/status/1492292279129804806
https://twitter.com/JaimeeJakobczak/status/1492292268354584578
https://twitter.com/consequence/status/1492245783084773383/photo/1
https://twitter.com/consequence/status/1492245783084773383
https://twitter.com/EVStyle2/status/1492292266169298944
https://twitter.com/SammyMorgan/status/1492292246766436355
https://twitter.com/gayesian/status/1492292246456184841
https://twitter.com/khendriix_/status/1492292245734707202
https://twitter.com/Mauro_Sosa_S/status/1492292242320539650
</code>```

I tried different codes after researching, but to no avail. :/

答:
You just need to de-indent the last line there:

stopwords = ['/people', '/photo/1']
link_list = []
for link in links:
    for i in stopwords:
        remove = link.replace(i, "")
        link = remove
    link_list.append(link)
```
<p>In its original position, it would append the link with <code>/people</code> removed but before removing <code>/photo/1</code>. Then it would append again with <code>/photo/1</code> removed.</p>
<p>You could alternatively apply this suggestion here and use a compiled regular expression:</p>
<pre class="lang-py prettyprint-override"><code>import re

stopwords = ['/people', '/photo/1']
pattern = re.compile('|'.join(map(re.escape, stopwords)))
link_list = [pattern.sub('', link) for link in links]
</code>```

Title: Remove certain words from URL

Body:
I scraped tweet statuses, from which I'm removing certain words; however, it doesn't work effectively as it only removes the first string in "stopwords".

Code:

stopwords = ['/people', '/photo/1']
link_list = []
for link in links:
    for i in stopwords:
        remove = link.replace(i, "")
        link = remove
        link_list.append(link)

Output:

https://twitter.com/CultOfCurtis/status/1492292326051483648
https://twitter.com/ZBumblenuts/status/1492292306149560321
https://twitter.com/AndreWillemse4/status/1492292279129804806
https://twitter.com/JaimeeJakobczak/status/1492292268354584578
https://twitter.com/consequence/status/1492245783084773383/photo/1
https://twitter.com/consequence/status/1492245783084773383
https://twitter.com/EVStyle2/status/1492292266169298944
https://twitter.com/SammyMorgan/status/1492292246766436355
https://twitter.com/gayesian/status/1492292246456184841
https://twitter.com/khendriix_/status/1492292245734707202
https://twitter.com/Mauro_Sosa_S/status/1492292242320539650

I tried different codes after researching, but to no avail. :/

Body:
You just need to de-indent the last line there:

stopwords = ['/people', '/photo/1']
link_list = []
for link in links:
    for i in stopwords:
        remove = link.replace(i, "")
        link = remove
    link_list.append(link)

In its original position, it would append the link with /people removed but before removing /photo/1. Then it would append again with /photo/1 removed.

You could alternatively apply this suggestion here and use a compiled regular expression:

import re

stopwords = ['/people', '/photo/1']
pattern = re.compile('|'.join(map(re.escape, stopwords)))
link_list = [pattern.sub('', link) for link in links]


问:
How to re-launch a child_process with new arguments?
Currently I’m working on an Electron.js project where I need to use shell commands to establish continuous communication with a remote server. To do so I’m spawning Node’s child_process and attaching a callback function to digest data being received alike so:

```<code>let process = child_process.spawn(“myCommand -–argument1”, [], PROCESS_OPTIONS);

process.stdout.on(“data” (data) => {
    callback(data);
});
</code>```

Every now and then when a user provides an input through the application’s UI, I have to pass some additional arguments to the process that is already running. To accomplish that I’m killing the process and starting a new one with updated command: myCommand --argument1 --argument2

The problem with that approach is that it leaves 2-3 zombie processes running in the task manager under the main Electron process every time I re-launch the command.
Task manager screenshot

I am new to Node.js, could anyone suggest a better solution to this scenario?

答:
You can communicate with the child process via the stdin/stdout.
So this should to execute code on each message).
Example:

```<code>//parent.js
const childProcess = require('child_process');

const child = childProcess.spawn('node', [`${__dirname}\\child.js`]);
child.stdout.on('data', data => {
   const msg = data.toString('utf8');
   console.log('Parent got message from child:', msg);
});

child.stderr.on('data', data => {
   console.log('child error:', data);
});

let itr = 0;
const intervalId = setInterval(() => {
   child.stdin.write(`${itr++}`);
}, 1000);

setTimeout(() => {
   clearInterval(intervalId);
   child.kill(0);
   process.kill(0);
}, 7000);
</code>```

```<code>// child.jd
process.stdin.on('data', data => {
   const msg = Number(data.toString('utf8'));
   const pow2 = Math.pow(msg, 2);
   process.stdout.write(`Hello from child process (got: ${msg} reply: ${pow2})`);
});
</code>```

```<code>$> node parent.js
Parent got message from child: Hello from child process (got: 0 reply: 0)
Parent got message from child: Hello from child process (got: 1 reply: 1)
Parent got message from child: Hello from child process (got: 2 reply: 4)
Parent got message from child: Hello from child process (got: 3 reply: 9)
Parent got message from child: Hello from child process (got: 4 reply: 16)
Parent got message from child: Hello from child process (got: 5 reply: 25)
</code>```

Body:
Currently I’m working on an Electron.js project where I need to use shell commands to establish continuous communication with a remote server. To do so I’m spawning Node’s child_process and attaching a callback function to digest data being received alike so:

let process = child_process.spawn(“myCommand -–argument1”, [], PROCESS_OPTIONS);

process.stdout.on(“data” (data) => {
    callback(data);
});

Every now and then when a user provides an input through the application’s UI, I have to pass some additional arguments to the process that is already running. To accomplish that I’m killing the process and starting a new one with updated command: myCommand --argument1 --argument2

The problem with that approach is that it leaves 2-3 zombie processes running in the task manager under the main Electron process every time I re-launch the command.
Task manager screenshot

I am new to Node.js, could anyone suggest a better solution to this scenario?

Body:
You can communicate with the child process via the stdin/stdout.
So this should to execute code on each message).
Example:

//parent.js
const childProcess = require('child_process');

const child = childProcess.spawn('node', [`${__dirname}\\child.js`]);
child.stdout.on('data', data => {
   const msg = data.toString('utf8');
   console.log('Parent got message from child:', msg);
});

child.stderr.on('data', data => {
   console.log('child error:', data);
});

let itr = 0;
const intervalId = setInterval(() => {
   child.stdin.write(`${itr++}`);
}, 1000);

setTimeout(() => {
   clearInterval(intervalId);
   child.kill(0);
   process.kill(0);
}, 7000);

// child.jd
process.stdin.on('data', data => {
   const msg = Number(data.toString('utf8'));
   const pow2 = Math.pow(msg, 2);
   process.stdout.write(`Hello from child process (got: ${msg} reply: ${pow2})`);
});

$> node parent.js
Parent got message from child: Hello from child process (got: 0 reply: 0)
Parent got message from child: Hello from child process (got: 1 reply: 1)
Parent got message from child: Hello from child process (got: 2 reply: 4)
Parent got message from child: Hello from child process (got: 3 reply: 9)
Parent got message from child: Hello from child process (got: 4 reply: 16)
Parent got message from child: Hello from child process (got: 5 reply: 25)


问:
Efficient jQuery / JavaScript code to calculate average values in array of objects
I have a large JavaScript array of objects.  Each object contains temperature data for each month for many years.  I would like to find the average temperature data for each temperature-type for each month (there are actually 13 months in my data intentionally, so I want averages for 13 months).

In this jsfiddle, I have been playing with a very small subset of the data:

const array1 =
[
    {
        "Year": 1980,
        "Month": 0,
        "Tmin": null,
        "Tmean": 11.1914,
        "Tmax": null,
        "Td": 7.01668,
        "RHmean": 76.1544,
        "RHmax": 61.7298,
        "WBGTmin": 8.3829,
        "WBGTmean": 9.75617,
        "WBGTmax": null,
        "WBGTmaxSun": null,
        "UTCImin": 9.41549,
        "UTCImean": 11.5612,
        "UTCImax": null,
        "HImin": 8.03456,
        "HImean": 10.9305,
        "HImax": 14.2173
    },
    {
        "Year": 1980,
        "Month": 1,
        "Tmin": 11.931,
        "Tmean": 15.0778,
        "Tmax": 18.1379,
        "Td": 10.4667,
        "RHmean": 74.6458,
        "RHmax": 61.0794,
        "WBGTmin": 11.3724,
        "WBGTmean": 13.3417,
        "WBGTmax": 15.1419,
        "WBGTmaxSun": null,
        "UTCImin": 12.7629,
        "UTCImean": 15.5132,
        "UTCImax": 18.0733,
        "HImin": 11.5267,
        "HImean": 14.5908,
        "HImax": 17.6032
    },
    {
        "Year": 1980,
        "Month": 2,
        "Tmin": 10.8621,
        "Tmean": 14.3429,
        "Tmax": 18.1379,
        "Td": 9.55555,
        "RHmean": 73.3624,
        "RHmax": 58.0879,
        "WBGTmin": 10.4187,
        "WBGTmean": 12.5424,
        "WBGTmax": 14.8529,
        "WBGTmaxSun": null,
        "UTCImin": 11.663,
        "UTCImean": 14.6836,
        "UTCImax": 17.9196,
        "HImin": 10.3846,
        "HImean": 13.7489,
        "HImax": 17.5251
    },
    {
        "Year": 1980,
        "Month": 3,
        "Tmin": 11.069,
        "Tmean": 13.7278,
        "Tmax": 17.3103,
        "Td": 9.47038,
        "RHmean": 76.4473,
        "RHmax": 61.5543,
        "WBGTmin": 10.6146,
        "WBGTmean": 12.1394,
        "WBGTmax": 14.3354,
        "WBGTmaxSun": null,
        "UTCImin": 11.8356,
        "UTCImean": 14.1294,
        "UTCImax": 17.2034,
        "HImin": 10.57,
        "HImean": 13.1527,
        "HImax": 16.7052
    },
    {
        "Year": 1980,
        "Month": 4,
        "Tmin": 9.37931,
        "Tmean": 12.9241,
        "Tmax": 16.2759,
        "Td": 8.23148,
        "RHmean": 74.3115,
        "RHmax": 59.5891,
        "WBGTmin": 9.04303,
        "WBGTmean": 11.2406,
        "WBGTmax": 13.2503,
        "WBGTmaxSun": null,
        "UTCImin": 10.0756,
        "UTCImean": 13.2498,
        "UTCImax": 16.0892,
        "HImin": 8.72126,
        "HImean": 12.2128,
        "HImax": 15.5158
    },
    {
        "Year": 1980,
        "Month": 5,
        "Tmin": 8.07407,
        "Tmean": 10.6399,
        "Tmax": 14.4444,
        "Td": null,
        "RHmean": 76.2411,
        "RHmax": 60.2131,
        "WBGTmin": 7.57442,
        "WBGTmean": null,
        "WBGTmax": null,
        "WBGTmaxSun": null,
        "UTCImin": 8.70486,
        "UTCImean": null,
        "UTCImax": null,
        "HImin": 7.28312,
        "HImean": 9.75634,
        "HImax": 13.4938
    },
    {
        "Year": 1980,
        "Month": 7,
        "Tmin": 3.87097,
        "Tmean": 6.74194,
        "Tmax": 10.8065,
        "Td": 2.06452,
        "RHmean": 72.9362,
        "RHmax": 55.8054,
        "WBGTmin": 3.4279,
        "WBGTmean": 5.32629,
        "WBGTmax": 8.05513,
        "WBGTmaxSun": null,
        "UTCImin": 4.16556,
        "UTCImean": 6.88706,
        "UTCImax": 10.5796,
        "HImin": 2.5963,
        "HImean": 5.3759,
        "HImax": 9.3998
    },
    {
        "Year": 1980,
        "Month": 9,
        "Tmin": 6.23333,
        "Tmean": 8.97223,
        "Tmax": 11.6,
        "Td": 6.1037,
        "RHmean": 82.351,
        "RHmax": 69.5854,
        "WBGTmin": 6.31845,
        "WBGTmean": 8.00618,
        "WBGTmax": 9.71308,
        "WBGTmaxSun": null,
        "UTCImin": 6.92209,
        "UTCImean": 9.45113,
        "UTCImax": 11.7794,
        "HImin": 5.4295,
        "HImean": 8.07536,
        "HImax": 10.6328
    },
    {
        "Year": 1980,
        "Month": 10,
        "Tmin": 8.43333,
        "Tmean": 11.2852,
        "Tmax": 13.6667,
        "Td": 7.64815,
        "RHmean": 78.9403,
        "RHmax": 67.924,
        "WBGTmin": 8.29363,
        "WBGTmean": 10.0097,
        "WBGTmax": 11.5281,
        "WBGTmaxSun": null,
        "UTCImin": 9.19437,
        "UTCImean": 11.7425,
        "UTCImax": 13.8014,
        "HImin": 7.76501,
        "HImean": 10.5307,
        "HImax": 12.863
    },
    {
        "Year": 1981,
        "Month": 0,
        "Tmin": 8.54919,
        "Tmean": 11.5048,
        "Tmax": 14.5909,
        "Td": 7.70727,
        "RHmean": 79.2693,
        "RHmax": 65.5782,
        "WBGTmin": 8.81321,
        "WBGTmean": 10.2214,
        "WBGTmax": 12.1636,
        "WBGTmaxSun": 13.6712,
        "UTCImin": 9.60639,
        "UTCImean": 11.9768,
        "UTCImax": 14.6651,
        "HImin": 8.13911,
        "HImean": 11.1262,
        "HImax": 14.1329
    },
    {
        "Year": 1981,
        "Month": 1,
        "Tmin": 10.9355,
        "Tmean": 14.6649,
        "Tmax": 18.1935,
        "Td": 12.0968,
        "RHmean": 84.7151,
        "RHmax": 67.9045,
        "WBGTmin": 11.7611,
        "WBGTmean": 13.6596,
        "WBGTmax": 15.7362,
        "WBGTmaxSun": 18.1962,
        "UTCImin": 12.2129,
        "UTCImean": 15.4285,
        "UTCImax": 18.4067,
        "HImin": 10.6675,
        "HImean": 14.3994,
        "HImax": 17.8426
    },
    {
        "Year": 1981,
        "Month": 2,
        "Tmin": 12.0741,
        "Tmean": 14.5041,
        "Tmax": 17.5185,
        "Td": 12.251,
        "RHmean": 86.5258,
        "RHmax": 72.0491,
        "WBGTmin": 12.3043,
        "WBGTmean": 13.6124,
        "WBGTmax": 15.4261,
        "WBGTmaxSun": 17.545,
        "UTCImin": 13.2307,
        "UTCImean": 15.3403,
        "UTCImax": 17.8944,
        "HImin": 11.8769,
        "HImean": 14.2698,
        "HImax": 17.2081
    },
    {
        "Year": 1981,
        "Month": 3,
        "Tmin": 12.4074,
        "Tmean": 15.4167,
        "Tmax": 18.2593,
        "Td": 12.6071,
        "RHmean": 83.9611,
        "RHmax": 70.3348,
        "WBGTmin": 12.668,
        "WBGTmean": 14.3096,
        "WBGTmax": 15.9688,
        "WBGTmaxSun": 17.5687,
        "UTCImin": 13.5998,
        "UTCImean": 16.1949,
        "UTCImax": 18.5757,
        "HImin": 12.2142,
        "HImean": 15.2067,
        "HImax": 17.9783
    },
    {
        "Year": 1981,
        "Month": 4,
        "Tmin": 10,
        "Tmean": 12.7361,
        "Tmax": 15.8571,
        "Td": 9.64087,
        "RHmean": 82.5259,
        "RHmax": 67.9274,
        "WBGTmin": 10.0824,
        "WBGTmean": 11.6051,
        "WBGTmax": 13.5108,
        "WBGTmaxSun": 14.592,
        "UTCImin": 10.9405,
        "UTCImean": 13.3256,
        "UTCImax": 15.999,
        "HImin": 9.51275,
        "HImean": 12.2205,
        "HImax": 15.2729
    },
    {
        "Year": 1981,
        "Month": 5,
        "Tmin": 7.77419,
        "Tmean": 10.0627,
        "Tmax": 13.6129,
        "Td": 5.78494,
        "RHmean": 75.9491,
        "RHmax": 61.0582,
        "WBGTmin": 7.20217,
        "WBGTmean": 8.64684,
        "WBGTmax": 10.9509,
        "WBGTmaxSun": 11.6187,
        "UTCImin": 8.33175,
        "UTCImean": 10.4036,
        "UTCImax": 13.5211,
        "HImin": 6.89413,
        "HImean": 9.10776,
        "HImax": 12.6245
    },
    {
        "Year": 1981,
        "Month": 7,
        "Tmin": 4.9,
        "Tmean": 7.17407,
        "Tmax": 10.3667,
        "Td": 2.70556,
        "RHmean": 74.8556,
        "RHmax": 61.1368,
        "WBGTmin": 4.34986,
        "WBGTmean": 5.8641,
        "WBGTmax": 7.98966,
        "WBGTmaxSun": 8.615,
        "UTCImin": 5.264,
        "UTCImean": 7.39827,
        "UTCImax": 10.2977,
        "HImin": 3.69173,
        "HImean": 5.90138,
        "HImax": 9.05522
    },
    {
        "Year": 1981,
        "Month": 8,
        "Tmin": 4.45161,
        "Tmean": 7.92652,
        "Tmax": 11.871,
        "Td": 0.390681,
        "RHmean": 61.2032,
        "RHmax": 47.431,
        "WBGTmin": 3.40579,
        "WBGTmean": 5.77148,
        "WBGTmax": 8.40882,
        "WBGTmaxSun": 9.3788,
        "UTCImin": 4.54988,
        "UTCImean": 7.83204,
        "UTCImax": 11.4088,
        "HImin": 2.9492,
        "HImean": 6.37245,
        "HImax": 10.352
    },
    {
        "Year": 1981,
        "Month": 9,
        "Tmin": 4.2,
        "Tmean": 8.3537,
        "Tmax": 10.8667,
        "Td": 5.32407,
        "RHmean": 81.6902,
        "RHmax": 69.417,
        "WBGTmin": 5.1251,
        "WBGTmean": 7.35119,
        "WBGTmax": 9.0068,
        "WBGTmaxSun": 10.4248,
        "UTCImin": 4.87588,
        "UTCImean": 8.78665,
        "UTCImax": 11.0342,
        "HImin": 3.20796,
        "HImean": 7.37767,
        "HImax": 9.82164
    },
    {
        "Year": 1981,
        "Month": 10,
        "Tmin": 7.48387,
        "Tmean": 11.0681,
        "Tmax": 13.6774,
        "Td": 7.32616,
        "RHmean": 78.8369,
        "RHmax": 67.1361,
        "WBGTmin": 7.72401,
        "WBGTmean": 9.77781,
        "WBGTmax": 11.4299,
        "WBGTmaxSun": 13.2976,
        "UTCImin": 8.26469,
        "UTCImean": 11.5077,
        "UTCImax": 13.7745,
        "HImin": 6.74846,
        "HImean": 10.2892,
        "HImax": 12.8542
    },
    {
        "Year": 1981,
        "Month": 11,
        "Tmin": 10.1379,
        "Tmean": 13.2088,
        "Tmax": 16.0345,
        "Td": 9.78353,
        "RHmean": 80.1912,
        "RHmax": 67.215,
        "WBGTmin": 10.1662,
        "WBGTmean": 11.9142,
        "WBGTmax": 13.6553,
        "WBGTmaxSun": 15.937,
        "UTCImin": 11.0545,
        "UTCImean": 13.74,
        "UTCImax": 16.1454,
        "HImin": 9.6793,
        "HImean": 12.6796,
        "HImax": 15.4494
    },
    {
        "Year": 1981,
        "Month": 12,
        "Tmin": 12.3262,
        "Tmean": 14.8907,
        "Tmax": 17.3871,
        "Td": 11.7276,
        "RHmean": 81.5082,
        "RHmax": 69.7501,
        "WBGTmin": 12.1564,
        "WBGTmean": 13.6467,
        "WBGTmax": 15.1406,
        "WBGTmaxSun": 17.6416,
        "UTCImin": 13.3456,
        "UTCImean": 15.5432,
        "UTCImax": 17.6521,
        "HImin": 12.0881,
        "HImean": 14.5641,
        "HImax": 17.0036
    },
    {
        "Year": 1982,
        "Month": 0,
        "Tmin": 7.17557,
        "Tmean": 11.1063,
        "Tmax": 14.9062,
        "Td": 6.62961,
        "RHmean": 74.9441,
        "RHmax": 59.1579,
        "WBGTmin": 7.3061,
        "WBGTmean": 9.60836,
        "WBGTmax": 12.0246,
        "WBGTmaxSun": 13.5322,
        "UTCImin": 7.93259,
        "UTCImean": 11.4494,
        "UTCImax": 14.7667,
        "HImin": 6.40302,
        "HImean": 10.2599,
        "HImax": 14.0271
    },
    {
        "Year": 1982,
        "Month": 1,
        "Tmin": 10.3389,
        "Tmean": 14.1222,
        "Tmax": 17.5019,
        "Td": 10.3722,
        "RHmean": 78.3829,
        "RHmax": 63.6444,
        "WBGTmin": 10.5689,
        "WBGTmean": 12.6951,
        "WBGTmax": 14.7305,
        "WBGTmaxSun": 17.1905,
        "UTCImin": 11.3631,
        "UTCImean": 14.632,
        "UTCImax": 17.5026,
        "HImin": 9.92938,
        "HImean": 13.6372,
        "HImax": 16.9704
    },
    {
        "Year": 1982,
        "Month": 2,
        "Tmin": 12.248,
        "Tmean": 15.379,
        "Tmax": 18.9484,
        "Td": 12.2222,
        "RHmean": 81.5975,
        "RHmax": 65.3673,
        "WBGTmin": 12.3504,
        "WBGTmean": 14.1349,
        "WBGTmax": 16.2461,
        "WBGTmaxSun": 18.365,
        "UTCImin": 13.3921,
        "UTCImean": 16.0678,
        "UTCImax": 19.0792,
        "HImin": 12.0642,
        "HImean": 15.1036,
        "HImax": 18.6068
    },
    {
        "Year": 1982,
        "Month": 3,
        "Tmin": 10.6264,
        "Tmean": 14.567,
        "Tmax": 18.228,
        "Td": 10.5268,
        "RHmean": 77.2457,
        "RHmax": 61.7686,
        "WBGTmin": 10.8023,
        "WBGTmean": 13.0499,
        "WBGTmax": 15.2515,
        "WBGTmaxSun": 16.8514,
        "UTCImin": 11.6506,
        "UTCImean": 15.059,
        "UTCImax": 18.1618,
        "HImin": 10.2382,
        "HImean": 14.0968,
        "HImax": 17.7203
    },
    {
        "Year": 1982,
        "Month": 4,
        "Tmin": 8.28927,
        "Tmean": 12.3774,
        "Tmax": 16.6935,
        "Td": 7.12836,
        "RHmean": 71.6036,
        "RHmax": 54.429,
        "WBGTmin": 8.07749,
        "WBGTmean": 10.5633,
        "WBGTmax": 13.249,
        "WBGTmaxSun": 14.3302,
        "UTCImin": 9.00788,
        "UTCImean": 12.6247,
        "UTCImax": 16.3256,
        "HImin": 7.55299,
        "HImean": 11.5407,
        "HImax": 15.8404
    },
    {
        "Year": 1982,
        "Month": 5,
        "Tmin": 6.78927,
        "Tmean": 10.3755,
        "Tmax": 14.2874,
        "Td": 6.6705,
        "RHmean": 78.6915,
        "RHmax": 61.921,
        "WBGTmin": 7.05394,
        "WBGTmean": 9.11994,
        "WBGTmax": 11.6353,
        "WBGTmaxSun": 12.3031,
        "UTCImin": 7.54962,
        "UTCImean": 10.7974,
        "UTCImax": 14.2113,
        "HImin": 5.98517,
        "HImean": 9.52347,
        "HImax": 13.389
    },
    {
        "Year": 1982,
        "Month": 6,
        "Tmin": 4.53704,
        "Tmean": 8.02778,
        "Tmax": 12.8556,
        "Td": 1.36296,
        "RHmean": 63.9868,
        "RHmax": 46.6503,
        "WBGTmin": 3.75934,
        "WBGTmean": 6.06368,
        "WBGTmax": 9.27825,
        "WBGTmaxSun": 9.8104,
        "UTCImin": 4.75433,
        "UTCImean": 8.01639,
        "UTCImax": 12.3611,
        "HImin": 3.1271,
        "HImean": 6.55658,
        "HImax": 11.4148
    },
    {
        "Year": 1982,
        "Month": 7,
        "Tmin": 3.00896,
        "Tmean": 6.69176,
        "Tmax": 11.5233,
        "Td": 0.281363,
        "RHmean": 65.0132,
        "RHmax": 47.4322,
        "WBGTmin": 2.50418,
        "WBGTmean": 4.87147,
        "WBGTmax": 8.14736,
        "WBGTmaxSun": 8.7727,
        "UTCImin": 3.12808,
        "UTCImean": 6.64994,
        "UTCImax": 11.0682,
        "HImin": 1.4728,
        "HImean": 5.11363,
        "HImax": 9.96959
    },
    {
        "Year": 1982,
        "Month": 8,
        "Tmin": 3.89074,
        "Tmean": 8.25926,
        "Tmax": 11.8352,
        "Td": 4.6963,
        "RHmean": 78.8587,
        "RHmax": 62.6882,
        "WBGTmin": 4.70963,
        "WBGTmean": 7.12274,
        "WBGTmax": 9.46413,
        "WBGTmaxSun": 10.4341,
        "UTCImin": 4.53797,
        "UTCImean": 8.6311,
        "UTCImax": 11.8118,
        "HImin": 2.82464,
        "HImean": 7.1998,
        "HImax": 10.7114
    },
    {
        "Year": 1982,
        "Month": 9,
        "Tmin": 5.52778,
        "Tmean": 9.90556,
        "Tmax": 13.4352,
        "Td": 5.8963,
        "RHmean": 76.7366,
        "RHmax": 61.2182,
        "WBGTmin": 5.94218,
        "WBGTmean": 8.55935,
        "WBGTmax": 10.8363,
        "WBGTmaxSun": 12.2543,
        "UTCImin": 6.25308,
        "UTCImean": 10.2701,
        "UTCImax": 13.3514,
        "HImin": 4.66327,
        "HImean": 8.95547,
        "HImax": 12.4332
    },
    {
        "Year": 1982,
        "Month": 10,
        "Tmin": 4.80159,
        "Tmean": 10.1171,
        "Tmax": 13.8651,
        "Td": 4.42659,
        "RHmean": 70.1723,
        "RHmax": 55.4714,
        "WBGTmin": 5.06719,
        "WBGTmean": 8.30009,
        "WBGTmax": 10.719,
        "WBGTmaxSun": 12.5867,
        "UTCImin": 5.37704,
        "UTCImean": 10.2803,
        "UTCImax": 13.5843,
        "HImin": 3.73974,
        "HImean": 9.01666,
        "HImax": 12.756
    },
    {
        "Year": 1982,
        "Month": 11,
        "Tmin": 8.21839,
        "Tmean": 11.5766,
        "Tmax": 14.4866,
        "Td": 7.87931,
        "RHmean": 78.7804,
        "RHmax": 65.8273,
        "WBGTmin": 8.29848,
        "WBGTmean": 10.2893,
        "WBGTmax": 12.1182,
        "WBGTmaxSun": 14.3999,
        "UTCImin": 9.03572,
        "UTCImean": 12.0431,
        "UTCImax": 14.5568,
        "HImin": 7.56246,
        "HImean": 10.8471,
        "HImax": 13.7102
    },
    {
        "Year": 1982,
        "Month": 12,
        "Tmin": 8.25269,
        "Tmean": 12.2079,
        "Tmax": 15.5358,
        "Td": 8.49641,
        "RHmean": 78.2601,
        "RHmax": 63.4765,
        "WBGTmin": 8.53918,
        "WBGTmean": 10.8732,
        "WBGTmax": 12.944,
        "WBGTmaxSun": 15.445,
        "UTCImin": 9.14154,
        "UTCImean": 12.6763,
        "UTCImax": 15.5241,
        "HImin": 7.67627,
        "HImean": 11.528,
        "HImax": 14.8032
    }
];

function averages({avg, n}, tempInfo) {
    if (tempInfo.WBGTmaxSun == null) {
        return {avg, n};
    }

    return {
        avg: (tempInfo.WBGTmaxSun + n * avg) / (n + 1),
        n:   n + 1,
    };
}

// Calculations
// ----------------------------------------------------------------------------

// Calculate the average and display.
const initialVals       = {avg: 0, n: 0};
const averageVals = array1.reduce(averages, initialVals).avg;
console.log("Average:", averageVals);

//PSEUDOCODE:
// for each month:
//      for each tempType:
//          call array1.reduce(averages, initialVals).avg;

var avgx = array1
  .filter((x) => {
      return x.Month === 1;
  })
  .map(function(obj) {return obj.WBGTmaxSun})
  .reduce(function(a, b) { return a + b });

console.log("Average:", avgx);```
</div>
</div>
</p>
<p>I have explored the functions <em>reduce()</em>, <em>map()</em>, and <em>filter()</em>.<br />
I managed to get the code to work for all months, but for only one temperature-type (WBGTmaxSun).</p>
<p>However, the result I want is an array containing all temperature-types, with each temperature-type having an array of temperatures for each month.  Here is a screenshot of the output of my existing code, however the code is inefficient and doesn't ignore nulls in the calculations:</p>
<p><img src="https://i.stack.imgur.com/gxf7L.png" alt="enter image description here" /></p>
<p>In the original array of objects, some temperature-type properties have null values, so they should not influence the average calculations.</p>
<p>I was hoping to use my current code in the jsfiddle inside 2 loops.  Here is some pseduocode:</p>
```for each month:
    for each tempType:
        call array1.reduce(averages, initialVals).avg;
```

However, I don't know how to pass parameters for the month and temperature-type into the averages() function.

I could use multiple loops to achieve all of this, but I want to write efficient code.  I have studied this page for assistance: FUNCTIONAL JAVASCRIPT, however I've hit a wall.

答:
Loop over your object, adding entries to the result object for each type and month when first encountered. Otherwise just add the result to the existing type and month in the result object.

```<code>let result = {};

array1.forEach(({Year, Month, ...temps}) => {
  Object.entries(temps).forEach(([type, temp]) => {
    if (temp === null) { // skip null values
      return;
    }
    // Add entry for temperature type of it doesn't exist
    if (!(type in result)) {
      result[type] = [];
    }
    // Use month as array index within type
    if (result[type][Month]) {
      result[type][Month].push(temp);
    } else {
      result[type][Month] = [temp];
    }
  });
});
</code>```

const array1 = [{
    "Year": 1980,
    "Month": 0,
    "Tmin": null,
    "Tmean": 11.1914,
    "Tmax": null,
    "Td": 7.01668,
    "RHmean": 76.1544,
    "RHmax": 61.7298,
    "WBGTmin": 8.3829,
    "WBGTmean": 9.75617,
    "WBGTmax": null,
    "WBGTmaxSun": null,
    "UTCImin": 9.41549,
    "UTCImean": 11.5612,
    "UTCImax": null,
    "HImin": 8.03456,
    "HImean": 10.9305,
    "HImax": 14.2173
  },
  {
    "Year": 1980,
    "Month": 1,
    "Tmin": 11.931,
    "Tmean": 15.0778,
    "Tmax": 18.1379,
    "Td": 10.4667,
    "RHmean": 74.6458,
    "RHmax": 61.0794,
    "WBGTmin": 11.3724,
    "WBGTmean": 13.3417,
    "WBGTmax": 15.1419,
    "WBGTmaxSun": null,
    "UTCImin": 12.7629,
    "UTCImean": 15.5132,
    "UTCImax": 18.0733,
    "HImin": 11.5267,
    "HImean": 14.5908,
    "HImax": 17.6032
  },
  {
    "Year": 1980,
    "Month": 2,
    "Tmin": 10.8621,
    "Tmean": 14.3429,
    "Tmax": 18.1379,
    "Td": 9.55555,
    "RHmean": 73.3624,
    "RHmax": 58.0879,
    "WBGTmin": 10.4187,
    "WBGTmean": 12.5424,
    "WBGTmax": 14.8529,
    "WBGTmaxSun": null,
    "UTCImin": 11.663,
    "UTCImean": 14.6836,
    "UTCImax": 17.9196,
    "HImin": 10.3846,
    "HImean": 13.7489,
    "HImax": 17.5251
  },
  {
    "Year": 1980,
    "Month": 3,
    "Tmin": 11.069,
    "Tmean": 13.7278,
    "Tmax": 17.3103,
    "Td": 9.47038,
    "RHmean": 76.4473,
    "RHmax": 61.5543,
    "WBGTmin": 10.6146,
    "WBGTmean": 12.1394,
    "WBGTmax": 14.3354,
    "WBGTmaxSun": null,
    "UTCImin": 11.8356,
    "UTCImean": 14.1294,
    "UTCImax": 17.2034,
    "HImin": 10.57,
    "HImean": 13.1527,
    "HImax": 16.7052
  },
  {
    "Year": 1980,
    "Month": 4,
    "Tmin": 9.37931,
    "Tmean": 12.9241,
    "Tmax": 16.2759,
    "Td": 8.23148,
    "RHmean": 74.3115,
    "RHmax": 59.5891,
    "WBGTmin": 9.04303,
    "WBGTmean": 11.2406,
    "WBGTmax": 13.2503,
    "WBGTmaxSun": null,
    "UTCImin": 10.0756,
    "UTCImean": 13.2498,
    "UTCImax": 16.0892,
    "HImin": 8.72126,
    "HImean": 12.2128,
    "HImax": 15.5158
  },
  {
    "Year": 1980,
    "Month": 5,
    "Tmin": 8.07407,
    "Tmean": 10.6399,
    "Tmax": 14.4444,
    "Td": null,
    "RHmean": 76.2411,
    "RHmax": 60.2131,
    "WBGTmin": 7.57442,
    "WBGTmean": null,
    "WBGTmax": null,
    "WBGTmaxSun": null,
    "UTCImin": 8.70486,
    "UTCImean": null,
    "UTCImax": null,
    "HImin": 7.28312,
    "HImean": 9.75634,
    "HImax": 13.4938
  },
  {
    "Year": 1980,
    "Month": 7,
    "Tmin": 3.87097,
    "Tmean": 6.74194,
    "Tmax": 10.8065,
    "Td": 2.06452,
    "RHmean": 72.9362,
    "RHmax": 55.8054,
    "WBGTmin": 3.4279,
    "WBGTmean": 5.32629,
    "WBGTmax": 8.05513,
    "WBGTmaxSun": null,
    "UTCImin": 4.16556,
    "UTCImean": 6.88706,
    "UTCImax": 10.5796,
    "HImin": 2.5963,
    "HImean": 5.3759,
    "HImax": 9.3998
  },
  {
    "Year": 1980,
    "Month": 9,
    "Tmin": 6.23333,
    "Tmean": 8.97223,
    "Tmax": 11.6,
    "Td": 6.1037,
    "RHmean": 82.351,
    "RHmax": 69.5854,
    "WBGTmin": 6.31845,
    "WBGTmean": 8.00618,
    "WBGTmax": 9.71308,
    "WBGTmaxSun": null,
    "UTCImin": 6.92209,
    "UTCImean": 9.45113,
    "UTCImax": 11.7794,
    "HImin": 5.4295,
    "HImean": 8.07536,
    "HImax": 10.6328
  },
  {
    "Year": 1980,
    "Month": 10,
    "Tmin": 8.43333,
    "Tmean": 11.2852,
    "Tmax": 13.6667,
    "Td": 7.64815,
    "RHmean": 78.9403,
    "RHmax": 67.924,
    "WBGTmin": 8.29363,
    "WBGTmean": 10.0097,
    "WBGTmax": 11.5281,
    "WBGTmaxSun": null,
    "UTCImin": 9.19437,
    "UTCImean": 11.7425,
    "UTCImax": 13.8014,
    "HImin": 7.76501,
    "HImean": 10.5307,
    "HImax": 12.863
  },
  {
    "Year": 1981,
    "Month": 0,
    "Tmin": 8.54919,
    "Tmean": 11.5048,
    "Tmax": 14.5909,
    "Td": 7.70727,
    "RHmean": 79.2693,
    "RHmax": 65.5782,
    "WBGTmin": 8.81321,
    "WBGTmean": 10.2214,
    "WBGTmax": 12.1636,
    "WBGTmaxSun": 13.6712,
    "UTCImin": 9.60639,
    "UTCImean": 11.9768,
    "UTCImax": 14.6651,
    "HImin": 8.13911,
    "HImean": 11.1262,
    "HImax": 14.1329
  },
  {
    "Year": 1981,
    "Month": 1,
    "Tmin": 10.9355,
    "Tmean": 14.6649,
    "Tmax": 18.1935,
    "Td": 12.0968,
    "RHmean": 84.7151,
    "RHmax": 67.9045,
    "WBGTmin": 11.7611,
    "WBGTmean": 13.6596,
    "WBGTmax": 15.7362,
    "WBGTmaxSun": 18.1962,
    "UTCImin": 12.2129,
    "UTCImean": 15.4285,
    "UTCImax": 18.4067,
    "HImin": 10.6675,
    "HImean": 14.3994,
    "HImax": 17.8426
  },
  {
    "Year": 1981,
    "Month": 2,
    "Tmin": 12.0741,
    "Tmean": 14.5041,
    "Tmax": 17.5185,
    "Td": 12.251,
    "RHmean": 86.5258,
    "RHmax": 72.0491,
    "WBGTmin": 12.3043,
    "WBGTmean": 13.6124,
    "WBGTmax": 15.4261,
    "WBGTmaxSun": 17.545,
    "UTCImin": 13.2307,
    "UTCImean": 15.3403,
    "UTCImax": 17.8944,
    "HImin": 11.8769,
    "HImean": 14.2698,
    "HImax": 17.2081
  },
  {
    "Year": 1981,
    "Month": 3,
    "Tmin": 12.4074,
    "Tmean": 15.4167,
    "Tmax": 18.2593,
    "Td": 12.6071,
    "RHmean": 83.9611,
    "RHmax": 70.3348,
    "WBGTmin": 12.668,
    "WBGTmean": 14.3096,
    "WBGTmax": 15.9688,
    "WBGTmaxSun": 17.5687,
    "UTCImin": 13.5998,
    "UTCImean": 16.1949,
    "UTCImax": 18.5757,
    "HImin": 12.2142,
    "HImean": 15.2067,
    "HImax": 17.9783
  },
  {
    "Year": 1981,
    "Month": 4,
    "Tmin": 10,
    "Tmean": 12.7361,
    "Tmax": 15.8571,
    "Td": 9.64087,
    "RHmean": 82.5259,
    "RHmax": 67.9274,
    "WBGTmin": 10.0824,
    "WBGTmean": 11.6051,
    "WBGTmax": 13.5108,
    "WBGTmaxSun": 14.592,
    "UTCImin": 10.9405,
    "UTCImean": 13.3256,
    "UTCImax": 15.999,
    "HImin": 9.51275,
    "HImean": 12.2205,
    "HImax": 15.2729
  },
  {
    "Year": 1981,
    "Month": 5,
    "Tmin": 7.77419,
    "Tmean": 10.0627,
    "Tmax": 13.6129,
    "Td": 5.78494,
    "RHmean": 75.9491,
    "RHmax": 61.0582,
    "WBGTmin": 7.20217,
    "WBGTmean": 8.64684,
    "WBGTmax": 10.9509,
    "WBGTmaxSun": 11.6187,
    "UTCImin": 8.33175,
    "UTCImean": 10.4036,
    "UTCImax": 13.5211,
    "HImin": 6.89413,
    "HImean": 9.10776,
    "HImax": 12.6245
  },
  {
    "Year": 1981,
    "Month": 7,
    "Tmin": 4.9,
    "Tmean": 7.17407,
    "Tmax": 10.3667,
    "Td": 2.70556,
    "RHmean": 74.8556,
    "RHmax": 61.1368,
    "WBGTmin": 4.34986,
    "WBGTmean": 5.8641,
    "WBGTmax": 7.98966,
    "WBGTmaxSun": 8.615,
    "UTCImin": 5.264,
    "UTCImean": 7.39827,
    "UTCImax": 10.2977,
    "HImin": 3.69173,
    "HImean": 5.90138,
    "HImax": 9.05522
  },
  {
    "Year": 1981,
    "Month": 8,
    "Tmin": 4.45161,
    "Tmean": 7.92652,
    "Tmax": 11.871,
    "Td": 0.390681,
    "RHmean": 61.2032,
    "RHmax": 47.431,
    "WBGTmin": 3.40579,
    "WBGTmean": 5.77148,
    "WBGTmax": 8.40882,
    "WBGTmaxSun": 9.3788,
    "UTCImin": 4.54988,
    "UTCImean": 7.83204,
    "UTCImax": 11.4088,
    "HImin": 2.9492,
    "HImean": 6.37245,
    "HImax": 10.352
  },
  {
    "Year": 1981,
    "Month": 9,
    "Tmin": 4.2,
    "Tmean": 8.3537,
    "Tmax": 10.8667,
    "Td": 5.32407,
    "RHmean": 81.6902,
    "RHmax": 69.417,
    "WBGTmin": 5.1251,
    "WBGTmean": 7.35119,
    "WBGTmax": 9.0068,
    "WBGTmaxSun": 10.4248,
    "UTCImin": 4.87588,
    "UTCImean": 8.78665,
    "UTCImax": 11.0342,
    "HImin": 3.20796,
    "HImean": 7.37767,
    "HImax": 9.82164
  },
  {
    "Year": 1981,
    "Month": 10,
    "Tmin": 7.48387,
    "Tmean": 11.0681,
    "Tmax": 13.6774,
    "Td": 7.32616,
    "RHmean": 78.8369,
    "RHmax": 67.1361,
    "WBGTmin": 7.72401,
    "WBGTmean": 9.77781,
    "WBGTmax": 11.4299,
    "WBGTmaxSun": 13.2976,
    "UTCImin": 8.26469,
    "UTCImean": 11.5077,
    "UTCImax": 13.7745,
    "HImin": 6.74846,
    "HImean": 10.2892,
    "HImax": 12.8542
  },
  {
    "Year": 1981,
    "Month": 11,
    "Tmin": 10.1379,
    "Tmean": 13.2088,
    "Tmax": 16.0345,
    "Td": 9.78353,
    "RHmean": 80.1912,
    "RHmax": 67.215,
    "WBGTmin": 10.1662,
    "WBGTmean": 11.9142,
    "WBGTmax": 13.6553,
    "WBGTmaxSun": 15.937,
    "UTCImin": 11.0545,
    "UTCImean": 13.74,
    "UTCImax": 16.1454,
    "HImin": 9.6793,
    "HImean": 12.6796,
    "HImax": 15.4494
  },
  {
    "Year": 1981,
    "Month": 12,
    "Tmin": 12.3262,
    "Tmean": 14.8907,
    "Tmax": 17.3871,
    "Td": 11.7276,
    "RHmean": 81.5082,
    "RHmax": 69.7501,
    "WBGTmin": 12.1564,
    "WBGTmean": 13.6467,
    "WBGTmax": 15.1406,
    "WBGTmaxSun": 17.6416,
    "UTCImin": 13.3456,
    "UTCImean": 15.5432,
    "UTCImax": 17.6521,
    "HImin": 12.0881,
    "HImean": 14.5641,
    "HImax": 17.0036
  },
  {
    "Year": 1982,
    "Month": 0,
    "Tmin": 7.17557,
    "Tmean": 11.1063,
    "Tmax": 14.9062,
    "Td": 6.62961,
    "RHmean": 74.9441,
    "RHmax": 59.1579,
    "WBGTmin": 7.3061,
    "WBGTmean": 9.60836,
    "WBGTmax": 12.0246,
    "WBGTmaxSun": 13.5322,
    "UTCImin": 7.93259,
    "UTCImean": 11.4494,
    "UTCImax": 14.7667,
    "HImin": 6.40302,
    "HImean": 10.2599,
    "HImax": 14.0271
  },
  {
    "Year": 1982,
    "Month": 1,
    "Tmin": 10.3389,
    "Tmean": 14.1222,
    "Tmax": 17.5019,
    "Td": 10.3722,
    "RHmean": 78.3829,
    "RHmax": 63.6444,
    "WBGTmin": 10.5689,
    "WBGTmean": 12.6951,
    "WBGTmax": 14.7305,
    "WBGTmaxSun": 17.1905,
    "UTCImin": 11.3631,
    "UTCImean": 14.632,
    "UTCImax": 17.5026,
    "HImin": 9.92938,
    "HImean": 13.6372,
    "HImax": 16.9704
  },
  {
    "Year": 1982,
    "Month": 2,
    "Tmin": 12.248,
    "Tmean": 15.379,
    "Tmax": 18.9484,
    "Td": 12.2222,
    "RHmean": 81.5975,
    "RHmax": 65.3673,
    "WBGTmin": 12.3504,
    "WBGTmean": 14.1349,
    "WBGTmax": 16.2461,
    "WBGTmaxSun": 18.365,
    "UTCImin": 13.3921,
    "UTCImean": 16.0678,
    "UTCImax": 19.0792,
    "HImin": 12.0642,
    "HImean": 15.1036,
    "HImax": 18.6068
  },
  {
    "Year": 1982,
    "Month": 3,
    "Tmin": 10.6264,
    "Tmean": 14.567,
    "Tmax": 18.228,
    "Td": 10.5268,
    "RHmean": 77.2457,
    "RHmax": 61.7686,
    "WBGTmin": 10.8023,
    "WBGTmean": 13.0499,
    "WBGTmax": 15.2515,
    "WBGTmaxSun": 16.8514,
    "UTCImin": 11.6506,
    "UTCImean": 15.059,
    "UTCImax": 18.1618,
    "HImin": 10.2382,
    "HImean": 14.0968,
    "HImax": 17.7203
  },
  {
    "Year": 1982,
    "Month": 4,
    "Tmin": 8.28927,
    "Tmean": 12.3774,
    "Tmax": 16.6935,
    "Td": 7.12836,
    "RHmean": 71.6036,
    "RHmax": 54.429,
    "WBGTmin": 8.07749,
    "WBGTmean": 10.5633,
    "WBGTmax": 13.249,
    "WBGTmaxSun": 14.3302,
    "UTCImin": 9.00788,
    "UTCImean": 12.6247,
    "UTCImax": 16.3256,
    "HImin": 7.55299,
    "HImean": 11.5407,
    "HImax": 15.8404
  },
  {
    "Year": 1982,
    "Month": 5,
    "Tmin": 6.78927,
    "Tmean": 10.3755,
    "Tmax": 14.2874,
    "Td": 6.6705,
    "RHmean": 78.6915,
    "RHmax": 61.921,
    "WBGTmin": 7.05394,
    "WBGTmean": 9.11994,
    "WBGTmax": 11.6353,
    "WBGTmaxSun": 12.3031,
    "UTCImin": 7.54962,
    "UTCImean": 10.7974,
    "UTCImax": 14.2113,
    "HImin": 5.98517,
    "HImean": 9.52347,
    "HImax": 13.389
  },
  {
    "Year": 1982,
    "Month": 6,
    "Tmin": 4.53704,
    "Tmean": 8.02778,
    "Tmax": 12.8556,
    "Td": 1.36296,
    "RHmean": 63.9868,
    "RHmax": 46.6503,
    "WBGTmin": 3.75934,
    "WBGTmean": 6.06368,
    "WBGTmax": 9.27825,
    "WBGTmaxSun": 9.8104,
    "UTCImin": 4.75433,
    "UTCImean": 8.01639,
    "UTCImax": 12.3611,
    "HImin": 3.1271,
    "HImean": 6.55658,
    "HImax": 11.4148
  },
  {
    "Year": 1982,
    "Month": 7,
    "Tmin": 3.00896,
    "Tmean": 6.69176,
    "Tmax": 11.5233,
    "Td": 0.281363,
    "RHmean": 65.0132,
    "RHmax": 47.4322,
    "WBGTmin": 2.50418,
    "WBGTmean": 4.87147,
    "WBGTmax": 8.14736,
    "WBGTmaxSun": 8.7727,
    "UTCImin": 3.12808,
    "UTCImean": 6.64994,
    "UTCImax": 11.0682,
    "HImin": 1.4728,
    "HImean": 5.11363,
    "HImax": 9.96959
  },
  {
    "Year": 1982,
    "Month": 8,
    "Tmin": 3.89074,
    "Tmean": 8.25926,
    "Tmax": 11.8352,
    "Td": 4.6963,
    "RHmean": 78.8587,
    "RHmax": 62.6882,
    "WBGTmin": 4.70963,
    "WBGTmean": 7.12274,
    "WBGTmax": 9.46413,
    "WBGTmaxSun": 10.4341,
    "UTCImin": 4.53797,
    "UTCImean": 8.6311,
    "UTCImax": 11.8118,
    "HImin": 2.82464,
    "HImean": 7.1998,
    "HImax": 10.7114
  },
  {
    "Year": 1982,
    "Month": 9,
    "Tmin": 5.52778,
    "Tmean": 9.90556,
    "Tmax": 13.4352,
    "Td": 5.8963,
    "RHmean": 76.7366,
    "RHmax": 61.2182,
    "WBGTmin": 5.94218,
    "WBGTmean": 8.55935,
    "WBGTmax": 10.8363,
    "WBGTmaxSun": 12.2543,
    "UTCImin": 6.25308,
    "UTCImean": 10.2701,
    "UTCImax": 13.3514,
    "HImin": 4.66327,
    "HImean": 8.95547,
    "HImax": 12.4332
  },
  {
    "Year": 1982,
    "Month": 10,
    "Tmin": 4.80159,
    "Tmean": 10.1171,
    "Tmax": 13.8651,
    "Td": 4.42659,
    "RHmean": 70.1723,
    "RHmax": 55.4714,
    "WBGTmin": 5.06719,
    "WBGTmean": 8.30009,
    "WBGTmax": 10.719,
    "WBGTmaxSun": 12.5867,
    "UTCImin": 5.37704,
    "UTCImean": 10.2803,
    "UTCImax": 13.5843,
    "HImin": 3.73974,
    "HImean": 9.01666,
    "HImax": 12.756
  },
  {
    "Year": 1982,
    "Month": 11,
    "Tmin": 8.21839,
    "Tmean": 11.5766,
    "Tmax": 14.4866,
    "Td": 7.87931,
    "RHmean": 78.7804,
    "RHmax": 65.8273,
    "WBGTmin": 8.29848,
    "WBGTmean": 10.2893,
    "WBGTmax": 12.1182,
    "WBGTmaxSun": 14.3999,
    "UTCImin": 9.03572,
    "UTCImean": 12.0431,
    "UTCImax": 14.5568,
    "HImin": 7.56246,
    "HImean": 10.8471,
    "HImax": 13.7102
  },
  {
    "Year": 1982,
    "Month": 12,
    "Tmin": 8.25269,
    "Tmean": 12.2079,
    "Tmax": 15.5358,
    "Td": 8.49641,
    "RHmean": 78.2601,
    "RHmax": 63.4765,
    "WBGTmin": 8.53918,
    "WBGTmean": 10.8732,
    "WBGTmax": 12.944,
    "WBGTmaxSun": 15.445,
    "UTCImin": 9.14154,
    "UTCImean": 12.6763,
    "UTCImax": 15.5241,
    "HImin": 7.67627,
    "HImean": 11.528,
    "HImax": 14.8032
  }
];

function averages({
  avg,
  n
}, tempInfo) {
  if (tempInfo.WBGTmaxSun == null) {
    return {
      avg,
      n
    };
  }

  return {
    avg: (tempInfo.WBGTmaxSun + n * avg) / (n + 1),
    n: n + 1,
  };
}

// Calculations
// ----------------------------------------------------------------------------

let result = {};

array1.forEach(({Year, Month, ...temps}) => {
  Object.entries(temps).forEach(([type, temp]) => {
    if (temp === null) { // skip null values
      return;
    }
    // Add entry for temperature type of it doesn't exist
    if (!(type in result)) {
      result[type] = [];
    }
    // Use month as array index within type
    if (result[type][Month]) {
      result[type][Month].push(temp);
    } else {
      result[type][Month] = [temp];
    }
  });
});

console.log(result);```

Body:
I have a large JavaScript array of objects.  Each object contains temperature data for each month for many years.  I would like to find the average temperature data for each temperature-type for each month (there are actually 13 months in my data intentionally, so I want averages for 13 months).

In this jsfiddle, I have been playing with a very small subset of the data:

const array1 =
[
    {
        "Year": 1980,
        "Month": 0,
        "Tmin": null,
        "Tmean": 11.1914,
        "Tmax": null,
        "Td": 7.01668,
        "RHmean": 76.1544,
        "RHmax": 61.7298,
        "WBGTmin": 8.3829,
        "WBGTmean": 9.75617,
        "WBGTmax": null,
        "WBGTmaxSun": null,
        "UTCImin": 9.41549,
        "UTCImean": 11.5612,
        "UTCImax": null,
        "HImin": 8.03456,
        "HImean": 10.9305,
        "HImax": 14.2173
    },
    {
        "Year": 1980,
        "Month": 1,
        "Tmin": 11.931,
        "Tmean": 15.0778,
        "Tmax": 18.1379,
        "Td": 10.4667,
        "RHmean": 74.6458,
        "RHmax": 61.0794,
        "WBGTmin": 11.3724,
        "WBGTmean": 13.3417,
        "WBGTmax": 15.1419,
        "WBGTmaxSun": null,
        "UTCImin": 12.7629,
        "UTCImean": 15.5132,
        "UTCImax": 18.0733,
        "HImin": 11.5267,
        "HImean": 14.5908,
        "HImax": 17.6032
    },
    {
        "Year": 1980,
        "Month": 2,
        "Tmin": 10.8621,
        "Tmean": 14.3429,
        "Tmax": 18.1379,
        "Td": 9.55555,
        "RHmean": 73.3624,
        "RHmax": 58.0879,
        "WBGTmin": 10.4187,
        "WBGTmean": 12.5424,
        "WBGTmax": 14.8529,
        "WBGTmaxSun": null,
        "UTCImin": 11.663,
        "UTCImean": 14.6836,
        "UTCImax": 17.9196,
        "HImin": 10.3846,
        "HImean": 13.7489,
        "HImax": 17.5251
    },
    {
        "Year": 1980,
        "Month": 3,
        "Tmin": 11.069,
        "Tmean": 13.7278,
        "Tmax": 17.3103,
        "Td": 9.47038,
        "RHmean": 76.4473,
        "RHmax": 61.5543,
        "WBGTmin": 10.6146,
        "WBGTmean": 12.1394,
        "WBGTmax": 14.3354,
        "WBGTmaxSun": null,
        "UTCImin": 11.8356,
        "UTCImean": 14.1294,
        "UTCImax": 17.2034,
        "HImin": 10.57,
        "HImean": 13.1527,
        "HImax": 16.7052
    },
    {
        "Year": 1980,
        "Month": 4,
        "Tmin": 9.37931,
        "Tmean": 12.9241,
        "Tmax": 16.2759,
        "Td": 8.23148,
        "RHmean": 74.3115,
        "RHmax": 59.5891,
        "WBGTmin": 9.04303,
        "WBGTmean": 11.2406,
        "WBGTmax": 13.2503,
        "WBGTmaxSun": null,
        "UTCImin": 10.0756,
        "UTCImean": 13.2498,
        "UTCImax": 16.0892,
        "HImin": 8.72126,
        "HImean": 12.2128,
        "HImax": 15.5158
    },
    {
        "Year": 1980,
        "Month": 5,
        "Tmin": 8.07407,
        "Tmean": 10.6399,
        "Tmax": 14.4444,
        "Td": null,
        "RHmean": 76.2411,
        "RHmax": 60.2131,
        "WBGTmin": 7.57442,
        "WBGTmean": null,
        "WBGTmax": null,
        "WBGTmaxSun": null,
        "UTCImin": 8.70486,
        "UTCImean": null,
        "UTCImax": null,
        "HImin": 7.28312,
        "HImean": 9.75634,
        "HImax": 13.4938
    },
    {
        "Year": 1980,
        "Month": 7,
        "Tmin": 3.87097,
        "Tmean": 6.74194,
        "Tmax": 10.8065,
        "Td": 2.06452,
        "RHmean": 72.9362,
        "RHmax": 55.8054,
        "WBGTmin": 3.4279,
        "WBGTmean": 5.32629,
        "WBGTmax": 8.05513,
        "WBGTmaxSun": null,
        "UTCImin": 4.16556,
        "UTCImean": 6.88706,
        "UTCImax": 10.5796,
        "HImin": 2.5963,
        "HImean": 5.3759,
        "HImax": 9.3998
    },
    {
        "Year": 1980,
        "Month": 9,
        "Tmin": 6.23333,
        "Tmean": 8.97223,
        "Tmax": 11.6,
        "Td": 6.1037,
        "RHmean": 82.351,
        "RHmax": 69.5854,
        "WBGTmin": 6.31845,
        "WBGTmean": 8.00618,
        "WBGTmax": 9.71308,
        "WBGTmaxSun": null,
        "UTCImin": 6.92209,
        "UTCImean": 9.45113,
        "UTCImax": 11.7794,
        "HImin": 5.4295,
        "HImean": 8.07536,
        "HImax": 10.6328
    },
    {
        "Year": 1980,
        "Month": 10,
        "Tmin": 8.43333,
        "Tmean": 11.2852,
        "Tmax": 13.6667,
        "Td": 7.64815,
        "RHmean": 78.9403,
        "RHmax": 67.924,
        "WBGTmin": 8.29363,
        "WBGTmean": 10.0097,
        "WBGTmax": 11.5281,
        "WBGTmaxSun": null,
        "UTCImin": 9.19437,
        "UTCImean": 11.7425,
        "UTCImax": 13.8014,
        "HImin": 7.76501,
        "HImean": 10.5307,
        "HImax": 12.863
    },
    {
        "Year": 1981,
        "Month": 0,
        "Tmin": 8.54919,
        "Tmean": 11.5048,
        "Tmax": 14.5909,
        "Td": 7.70727,
        "RHmean": 79.2693,
        "RHmax": 65.5782,
        "WBGTmin": 8.81321,
        "WBGTmean": 10.2214,
        "WBGTmax": 12.1636,
        "WBGTmaxSun": 13.6712,
        "UTCImin": 9.60639,
        "UTCImean": 11.9768,
        "UTCImax": 14.6651,
        "HImin": 8.13911,
        "HImean": 11.1262,
        "HImax": 14.1329
    },
    {
        "Year": 1981,
        "Month": 1,
        "Tmin": 10.9355,
        "Tmean": 14.6649,
        "Tmax": 18.1935,
        "Td": 12.0968,
        "RHmean": 84.7151,
        "RHmax": 67.9045,
        "WBGTmin": 11.7611,
        "WBGTmean": 13.6596,
        "WBGTmax": 15.7362,
        "WBGTmaxSun": 18.1962,
        "UTCImin": 12.2129,
        "UTCImean": 15.4285,
        "UTCImax": 18.4067,
        "HImin": 10.6675,
        "HImean": 14.3994,
        "HImax": 17.8426
    },
    {
        "Year": 1981,
        "Month": 2,
        "Tmin": 12.0741,
        "Tmean": 14.5041,
        "Tmax": 17.5185,
        "Td": 12.251,
        "RHmean": 86.5258,
        "RHmax": 72.0491,
        "WBGTmin": 12.3043,
        "WBGTmean": 13.6124,
        "WBGTmax": 15.4261,
        "WBGTmaxSun": 17.545,
        "UTCImin": 13.2307,
        "UTCImean": 15.3403,
        "UTCImax": 17.8944,
        "HImin": 11.8769,
        "HImean": 14.2698,
        "HImax": 17.2081
    },
    {
        "Year": 1981,
        "Month": 3,
        "Tmin": 12.4074,
        "Tmean": 15.4167,
        "Tmax": 18.2593,
        "Td": 12.6071,
        "RHmean": 83.9611,
        "RHmax": 70.3348,
        "WBGTmin": 12.668,
        "WBGTmean": 14.3096,
        "WBGTmax": 15.9688,
        "WBGTmaxSun": 17.5687,
        "UTCImin": 13.5998,
        "UTCImean": 16.1949,
        "UTCImax": 18.5757,
        "HImin": 12.2142,
        "HImean": 15.2067,
        "HImax": 17.9783
    },
    {
        "Year": 1981,
        "Month": 4,
        "Tmin": 10,
        "Tmean": 12.7361,
        "Tmax": 15.8571,
        "Td": 9.64087,
        "RHmean": 82.5259,
        "RHmax": 67.9274,
        "WBGTmin": 10.0824,
        "WBGTmean": 11.6051,
        "WBGTmax": 13.5108,
        "WBGTmaxSun": 14.592,
        "UTCImin": 10.9405,
        "UTCImean": 13.3256,
        "UTCImax": 15.999,
        "HImin": 9.51275,
        "HImean": 12.2205,
        "HImax": 15.2729
    },
    {
        "Year": 1981,
        "Month": 5,
        "Tmin": 7.77419,
        "Tmean": 10.0627,
        "Tmax": 13.6129,
        "Td": 5.78494,
        "RHmean": 75.9491,
        "RHmax": 61.0582,
        "WBGTmin": 7.20217,
        "WBGTmean": 8.64684,
        "WBGTmax": 10.9509,
        "WBGTmaxSun": 11.6187,
        "UTCImin": 8.33175,
        "UTCImean": 10.4036,
        "UTCImax": 13.5211,
        "HImin": 6.89413,
        "HImean": 9.10776,
        "HImax": 12.6245
    },
    {
        "Year": 1981,
        "Month": 7,
        "Tmin": 4.9,
        "Tmean": 7.17407,
        "Tmax": 10.3667,
        "Td": 2.70556,
        "RHmean": 74.8556,
        "RHmax": 61.1368,
        "WBGTmin": 4.34986,
        "WBGTmean": 5.8641,
        "WBGTmax": 7.98966,
        "WBGTmaxSun": 8.615,
        "UTCImin": 5.264,
        "UTCImean": 7.39827,
        "UTCImax": 10.2977,
        "HImin": 3.69173,
        "HImean": 5.90138,
        "HImax": 9.05522
    },
    {
        "Year": 1981,
        "Month": 8,
        "Tmin": 4.45161,
        "Tmean": 7.92652,
        "Tmax": 11.871,
        "Td": 0.390681,
        "RHmean": 61.2032,
        "RHmax": 47.431,
        "WBGTmin": 3.40579,
        "WBGTmean": 5.77148,
        "WBGTmax": 8.40882,
        "WBGTmaxSun": 9.3788,
        "UTCImin": 4.54988,
        "UTCImean": 7.83204,
        "UTCImax": 11.4088,
        "HImin": 2.9492,
        "HImean": 6.37245,
        "HImax": 10.352
    },
    {
        "Year": 1981,
        "Month": 9,
        "Tmin": 4.2,
        "Tmean": 8.3537,
        "Tmax": 10.8667,
        "Td": 5.32407,
        "RHmean": 81.6902,
        "RHmax": 69.417,
        "WBGTmin": 5.1251,
        "WBGTmean": 7.35119,
        "WBGTmax": 9.0068,
        "WBGTmaxSun": 10.4248,
        "UTCImin": 4.87588,
        "UTCImean": 8.78665,
        "UTCImax": 11.0342,
        "HImin": 3.20796,
        "HImean": 7.37767,
        "HImax": 9.82164
    },
    {
        "Year": 1981,
        "Month": 10,
        "Tmin": 7.48387,
        "Tmean": 11.0681,
        "Tmax": 13.6774,
        "Td": 7.32616,
        "RHmean": 78.8369,
        "RHmax": 67.1361,
        "WBGTmin": 7.72401,
        "WBGTmean": 9.77781,
        "WBGTmax": 11.4299,
        "WBGTmaxSun": 13.2976,
        "UTCImin": 8.26469,
        "UTCImean": 11.5077,
        "UTCImax": 13.7745,
        "HImin": 6.74846,
        "HImean": 10.2892,
        "HImax": 12.8542
    },
    {
        "Year": 1981,
        "Month": 11,
        "Tmin": 10.1379,
        "Tmean": 13.2088,
        "Tmax": 16.0345,
        "Td": 9.78353,
        "RHmean": 80.1912,
        "RHmax": 67.215,
        "WBGTmin": 10.1662,
        "WBGTmean": 11.9142,
        "WBGTmax": 13.6553,
        "WBGTmaxSun": 15.937,
        "UTCImin": 11.0545,
        "UTCImean": 13.74,
        "UTCImax": 16.1454,
        "HImin": 9.6793,
        "HImean": 12.6796,
        "HImax": 15.4494
    },
    {
        "Year": 1981,
        "Month": 12,
        "Tmin": 12.3262,
        "Tmean": 14.8907,
        "Tmax": 17.3871,
        "Td": 11.7276,
        "RHmean": 81.5082,
        "RHmax": 69.7501,
        "WBGTmin": 12.1564,
        "WBGTmean": 13.6467,
        "WBGTmax": 15.1406,
        "WBGTmaxSun": 17.6416,
        "UTCImin": 13.3456,
        "UTCImean": 15.5432,
        "UTCImax": 17.6521,
        "HImin": 12.0881,
        "HImean": 14.5641,
        "HImax": 17.0036
    },
    {
        "Year": 1982,
        "Month": 0,
        "Tmin": 7.17557,
        "Tmean": 11.1063,
        "Tmax": 14.9062,
        "Td": 6.62961,
        "RHmean": 74.9441,
        "RHmax": 59.1579,
        "WBGTmin": 7.3061,
        "WBGTmean": 9.60836,
        "WBGTmax": 12.0246,
        "WBGTmaxSun": 13.5322,
        "UTCImin": 7.93259,
        "UTCImean": 11.4494,
        "UTCImax": 14.7667,
        "HImin": 6.40302,
        "HImean": 10.2599,
        "HImax": 14.0271
    },
    {
        "Year": 1982,
        "Month": 1,
        "Tmin": 10.3389,
        "Tmean": 14.1222,
        "Tmax": 17.5019,
        "Td": 10.3722,
        "RHmean": 78.3829,
        "RHmax": 63.6444,
        "WBGTmin": 10.5689,
        "WBGTmean": 12.6951,
        "WBGTmax": 14.7305,
        "WBGTmaxSun": 17.1905,
        "UTCImin": 11.3631,
        "UTCImean": 14.632,
        "UTCImax": 17.5026,
        "HImin": 9.92938,
        "HImean": 13.6372,
        "HImax": 16.9704
    },
    {
        "Year": 1982,
        "Month": 2,
        "Tmin": 12.248,
        "Tmean": 15.379,
        "Tmax": 18.9484,
        "Td": 12.2222,
        "RHmean": 81.5975,
        "RHmax": 65.3673,
        "WBGTmin": 12.3504,
        "WBGTmean": 14.1349,
        "WBGTmax": 16.2461,
        "WBGTmaxSun": 18.365,
        "UTCImin": 13.3921,
        "UTCImean": 16.0678,
        "UTCImax": 19.0792,
        "HImin": 12.0642,
        "HImean": 15.1036,
        "HImax": 18.6068
    },
    {
        "Year": 1982,
        "Month": 3,
        "Tmin": 10.6264,
        "Tmean": 14.567,
        "Tmax": 18.228,
        "Td": 10.5268,
        "RHmean": 77.2457,
        "RHmax": 61.7686,
        "WBGTmin": 10.8023,
        "WBGTmean": 13.0499,
        "WBGTmax": 15.2515,
        "WBGTmaxSun": 16.8514,
        "UTCImin": 11.6506,
        "UTCImean": 15.059,
        "UTCImax": 18.1618,
        "HImin": 10.2382,
        "HImean": 14.0968,
        "HImax": 17.7203
    },
    {
        "Year": 1982,
        "Month": 4,
        "Tmin": 8.28927,
        "Tmean": 12.3774,
        "Tmax": 16.6935,
        "Td": 7.12836,
        "RHmean": 71.6036,
        "RHmax": 54.429,
        "WBGTmin": 8.07749,
        "WBGTmean": 10.5633,
        "WBGTmax": 13.249,
        "WBGTmaxSun": 14.3302,
        "UTCImin": 9.00788,
        "UTCImean": 12.6247,
        "UTCImax": 16.3256,
        "HImin": 7.55299,
        "HImean": 11.5407,
        "HImax": 15.8404
    },
    {
        "Year": 1982,
        "Month": 5,
        "Tmin": 6.78927,
        "Tmean": 10.3755,
        "Tmax": 14.2874,
        "Td": 6.6705,
        "RHmean": 78.6915,
        "RHmax": 61.921,
        "WBGTmin": 7.05394,
        "WBGTmean": 9.11994,
        "WBGTmax": 11.6353,
        "WBGTmaxSun": 12.3031,
        "UTCImin": 7.54962,
        "UTCImean": 10.7974,
        "UTCImax": 14.2113,
        "HImin": 5.98517,
        "HImean": 9.52347,
        "HImax": 13.389
    },
    {
        "Year": 1982,
        "Month": 6,
        "Tmin": 4.53704,
        "Tmean": 8.02778,
        "Tmax": 12.8556,
        "Td": 1.36296,
        "RHmean": 63.9868,
        "RHmax": 46.6503,
        "WBGTmin": 3.75934,
        "WBGTmean": 6.06368,
        "WBGTmax": 9.27825,
        "WBGTmaxSun": 9.8104,
        "UTCImin": 4.75433,
        "UTCImean": 8.01639,
        "UTCImax": 12.3611,
        "HImin": 3.1271,
        "HImean": 6.55658,
        "HImax": 11.4148
    },
    {
        "Year": 1982,
        "Month": 7,
        "Tmin": 3.00896,
        "Tmean": 6.69176,
        "Tmax": 11.5233,
        "Td": 0.281363,
        "RHmean": 65.0132,
        "RHmax": 47.4322,
        "WBGTmin": 2.50418,
        "WBGTmean": 4.87147,
        "WBGTmax": 8.14736,
        "WBGTmaxSun": 8.7727,
        "UTCImin": 3.12808,
        "UTCImean": 6.64994,
        "UTCImax": 11.0682,
        "HImin": 1.4728,
        "HImean": 5.11363,
        "HImax": 9.96959
    },
    {
        "Year": 1982,
        "Month": 8,
        "Tmin": 3.89074,
        "Tmean": 8.25926,
        "Tmax": 11.8352,
        "Td": 4.6963,
        "RHmean": 78.8587,
        "RHmax": 62.6882,
        "WBGTmin": 4.70963,
        "WBGTmean": 7.12274,
        "WBGTmax": 9.46413,
        "WBGTmaxSun": 10.4341,
        "UTCImin": 4.53797,
        "UTCImean": 8.6311,
        "UTCImax": 11.8118,
        "HImin": 2.82464,
        "HImean": 7.1998,
        "HImax": 10.7114
    },
    {
        "Year": 1982,
        "Month": 9,
        "Tmin": 5.52778,
        "Tmean": 9.90556,
        "Tmax": 13.4352,
        "Td": 5.8963,
        "RHmean": 76.7366,
        "RHmax": 61.2182,
        "WBGTmin": 5.94218,
        "WBGTmean": 8.55935,
        "WBGTmax": 10.8363,
        "WBGTmaxSun": 12.2543,
        "UTCImin": 6.25308,
        "UTCImean": 10.2701,
        "UTCImax": 13.3514,
        "HImin": 4.66327,
        "HImean": 8.95547,
        "HImax": 12.4332
    },
    {
        "Year": 1982,
        "Month": 10,
        "Tmin": 4.80159,
        "Tmean": 10.1171,
        "Tmax": 13.8651,
        "Td": 4.42659,
        "RHmean": 70.1723,
        "RHmax": 55.4714,
        "WBGTmin": 5.06719,
        "WBGTmean": 8.30009,
        "WBGTmax": 10.719,
        "WBGTmaxSun": 12.5867,
        "UTCImin": 5.37704,
        "UTCImean": 10.2803,
        "UTCImax": 13.5843,
        "HImin": 3.73974,
        "HImean": 9.01666,
        "HImax": 12.756
    },
    {
        "Year": 1982,
        "Month": 11,
        "Tmin": 8.21839,
        "Tmean": 11.5766,
        "Tmax": 14.4866,
        "Td": 7.87931,
        "RHmean": 78.7804,
        "RHmax": 65.8273,
        "WBGTmin": 8.29848,
        "WBGTmean": 10.2893,
        "WBGTmax": 12.1182,
        "WBGTmaxSun": 14.3999,
        "UTCImin": 9.03572,
        "UTCImean": 12.0431,
        "UTCImax": 14.5568,
        "HImin": 7.56246,
        "HImean": 10.8471,
        "HImax": 13.7102
    },
    {
        "Year": 1982,
        "Month": 12,
        "Tmin": 8.25269,
        "Tmean": 12.2079,
        "Tmax": 15.5358,
        "Td": 8.49641,
        "RHmean": 78.2601,
        "RHmax": 63.4765,
        "WBGTmin": 8.53918,
        "WBGTmean": 10.8732,
        "WBGTmax": 12.944,
        "WBGTmaxSun": 15.445,
        "UTCImin": 9.14154,
        "UTCImean": 12.6763,
        "UTCImax": 15.5241,
        "HImin": 7.67627,
        "HImean": 11.528,
        "HImax": 14.8032
    }
];

function averages({avg, n}, tempInfo) {
    if (tempInfo.WBGTmaxSun == null) {
        return {avg, n};
    }

    return {
        avg: (tempInfo.WBGTmaxSun + n * avg) / (n + 1),
        n:   n + 1,
    };
}

// Calculations
// ----------------------------------------------------------------------------

// Calculate the average and display.
const initialVals       = {avg: 0, n: 0};
const averageVals = array1.reduce(averages, initialVals).avg;
console.log("Average:", averageVals);

//PSEUDOCODE:
// for each month:
//      for each tempType:
//          call array1.reduce(averages, initialVals).avg;

var avgx = array1
  .filter((x) => {
      return x.Month === 1;
  })
  .map(function(obj) {return obj.WBGTmaxSun})
  .reduce(function(a, b) { return a + b });

console.log("Average:", avgx);

I have explored the functions reduce(), map(), and filter().

I managed to get the code to work for all months, but for only one temperature-type (WBGTmaxSun).

However, the result I want is an array containing all temperature-types, with each temperature-type having an array of temperatures for each month.  Here is a screenshot of the output of my existing code, however the code is inefficient and doesn't ignore nulls in the calculations:

In the original array of objects, some temperature-type properties have null values, so they should not influence the average calculations.

I was hoping to use my current code in the jsfiddle inside 2 loops.  Here is some pseduocode:

for each month:
    for each tempType:
        call array1.reduce(averages, initialVals).avg;

However, I don't know how to pass parameters for the month and temperature-type into the averages() function.

I could use multiple loops to achieve all of this, but I want to write efficient code.  I have studied this page for assistance: FUNCTIONAL JAVASCRIPT, however I've hit a wall.

Body:
Loop over your object, adding entries to the result object for each type and month when first encountered. Otherwise just add the result to the existing type and month in the result object.

let result = {};

array1.forEach(({Year, Month, ...temps}) => {
  Object.entries(temps).forEach(([type, temp]) => {
    if (temp === null) { // skip null values
      return;
    }
    // Add entry for temperature type of it doesn't exist
    if (!(type in result)) {
      result[type] = [];
    }
    // Use month as array index within type
    if (result[type][Month]) {
      result[type][Month].push(temp);
    } else {
      result[type][Month] = [temp];
    }
  });
});

const array1 = [{
    "Year": 1980,
    "Month": 0,
    "Tmin": null,
    "Tmean": 11.1914,
    "Tmax": null,
    "Td": 7.01668,
    "RHmean": 76.1544,
    "RHmax": 61.7298,
    "WBGTmin": 8.3829,
    "WBGTmean": 9.75617,
    "WBGTmax": null,
    "WBGTmaxSun": null,
    "UTCImin": 9.41549,
    "UTCImean": 11.5612,
    "UTCImax": null,
    "HImin": 8.03456,
    "HImean": 10.9305,
    "HImax": 14.2173
  },
  {
    "Year": 1980,
    "Month": 1,
    "Tmin": 11.931,
    "Tmean": 15.0778,
    "Tmax": 18.1379,
    "Td": 10.4667,
    "RHmean": 74.6458,
    "RHmax": 61.0794,
    "WBGTmin": 11.3724,
    "WBGTmean": 13.3417,
    "WBGTmax": 15.1419,
    "WBGTmaxSun": null,
    "UTCImin": 12.7629,
    "UTCImean": 15.5132,
    "UTCImax": 18.0733,
    "HImin": 11.5267,
    "HImean": 14.5908,
    "HImax": 17.6032
  },
  {
    "Year": 1980,
    "Month": 2,
    "Tmin": 10.8621,
    "Tmean": 14.3429,
    "Tmax": 18.1379,
    "Td": 9.55555,
    "RHmean": 73.3624,
    "RHmax": 58.0879,
    "WBGTmin": 10.4187,
    "WBGTmean": 12.5424,
    "WBGTmax": 14.8529,
    "WBGTmaxSun": null,
    "UTCImin": 11.663,
    "UTCImean": 14.6836,
    "UTCImax": 17.9196,
    "HImin": 10.3846,
    "HImean": 13.7489,
    "HImax": 17.5251
  },
  {
    "Year": 1980,
    "Month": 3,
    "Tmin": 11.069,
    "Tmean": 13.7278,
    "Tmax": 17.3103,
    "Td": 9.47038,
    "RHmean": 76.4473,
    "RHmax": 61.5543,
    "WBGTmin": 10.6146,
    "WBGTmean": 12.1394,
    "WBGTmax": 14.3354,
    "WBGTmaxSun": null,
    "UTCImin": 11.8356,
    "UTCImean": 14.1294,
    "UTCImax": 17.2034,
    "HImin": 10.57,
    "HImean": 13.1527,
    "HImax": 16.7052
  },
  {
    "Year": 1980,
    "Month": 4,
    "Tmin": 9.37931,
    "Tmean": 12.9241,
    "Tmax": 16.2759,
    "Td": 8.23148,
    "RHmean": 74.3115,
    "RHmax": 59.5891,
    "WBGTmin": 9.04303,
    "WBGTmean": 11.2406,
    "WBGTmax": 13.2503,
    "WBGTmaxSun": null,
    "UTCImin": 10.0756,
    "UTCImean": 13.2498,
    "UTCImax": 16.0892,
    "HImin": 8.72126,
    "HImean": 12.2128,
    "HImax": 15.5158
  },
  {
    "Year": 1980,
    "Month": 5,
    "Tmin": 8.07407,
    "Tmean": 10.6399,
    "Tmax": 14.4444,
    "Td": null,
    "RHmean": 76.2411,
    "RHmax": 60.2131,
    "WBGTmin": 7.57442,
    "WBGTmean": null,
    "WBGTmax": null,
    "WBGTmaxSun": null,
    "UTCImin": 8.70486,
    "UTCImean": null,
    "UTCImax": null,
    "HImin": 7.28312,
    "HImean": 9.75634,
    "HImax": 13.4938
  },
  {
    "Year": 1980,
    "Month": 7,
    "Tmin": 3.87097,
    "Tmean": 6.74194,
    "Tmax": 10.8065,
    "Td": 2.06452,
    "RHmean": 72.9362,
    "RHmax": 55.8054,
    "WBGTmin": 3.4279,
    "WBGTmean": 5.32629,
    "WBGTmax": 8.05513,
    "WBGTmaxSun": null,
    "UTCImin": 4.16556,
    "UTCImean": 6.88706,
    "UTCImax": 10.5796,
    "HImin": 2.5963,
    "HImean": 5.3759,
    "HImax": 9.3998
  },
  {
    "Year": 1980,
    "Month": 9,
    "Tmin": 6.23333,
    "Tmean": 8.97223,
    "Tmax": 11.6,
    "Td": 6.1037,
    "RHmean": 82.351,
    "RHmax": 69.5854,
    "WBGTmin": 6.31845,
    "WBGTmean": 8.00618,
    "WBGTmax": 9.71308,
    "WBGTmaxSun": null,
    "UTCImin": 6.92209,
    "UTCImean": 9.45113,
    "UTCImax": 11.7794,
    "HImin": 5.4295,
    "HImean": 8.07536,
    "HImax": 10.6328
  },
  {
    "Year": 1980,
    "Month": 10,
    "Tmin": 8.43333,
    "Tmean": 11.2852,
    "Tmax": 13.6667,
    "Td": 7.64815,
    "RHmean": 78.9403,
    "RHmax": 67.924,
    "WBGTmin": 8.29363,
    "WBGTmean": 10.0097,
    "WBGTmax": 11.5281,
    "WBGTmaxSun": null,
    "UTCImin": 9.19437,
    "UTCImean": 11.7425,
    "UTCImax": 13.8014,
    "HImin": 7.76501,
    "HImean": 10.5307,
    "HImax": 12.863
  },
  {
    "Year": 1981,
    "Month": 0,
    "Tmin": 8.54919,
    "Tmean": 11.5048,
    "Tmax": 14.5909,
    "Td": 7.70727,
    "RHmean": 79.2693,
    "RHmax": 65.5782,
    "WBGTmin": 8.81321,
    "WBGTmean": 10.2214,
    "WBGTmax": 12.1636,
    "WBGTmaxSun": 13.6712,
    "UTCImin": 9.60639,
    "UTCImean": 11.9768,
    "UTCImax": 14.6651,
    "HImin": 8.13911,
    "HImean": 11.1262,
    "HImax": 14.1329
  },
  {
    "Year": 1981,
    "Month": 1,
    "Tmin": 10.9355,
    "Tmean": 14.6649,
    "Tmax": 18.1935,
    "Td": 12.0968,
    "RHmean": 84.7151,
    "RHmax": 67.9045,
    "WBGTmin": 11.7611,
    "WBGTmean": 13.6596,
    "WBGTmax": 15.7362,
    "WBGTmaxSun": 18.1962,
    "UTCImin": 12.2129,
    "UTCImean": 15.4285,
    "UTCImax": 18.4067,
    "HImin": 10.6675,
    "HImean": 14.3994,
    "HImax": 17.8426
  },
  {
    "Year": 1981,
    "Month": 2,
    "Tmin": 12.0741,
    "Tmean": 14.5041,
    "Tmax": 17.5185,
    "Td": 12.251,
    "RHmean": 86.5258,
    "RHmax": 72.0491,
    "WBGTmin": 12.3043,
    "WBGTmean": 13.6124,
    "WBGTmax": 15.4261,
    "WBGTmaxSun": 17.545,
    "UTCImin": 13.2307,
    "UTCImean": 15.3403,
    "UTCImax": 17.8944,
    "HImin": 11.8769,
    "HImean": 14.2698,
    "HImax": 17.2081
  },
  {
    "Year": 1981,
    "Month": 3,
    "Tmin": 12.4074,
    "Tmean": 15.4167,
    "Tmax": 18.2593,
    "Td": 12.6071,
    "RHmean": 83.9611,
    "RHmax": 70.3348,
    "WBGTmin": 12.668,
    "WBGTmean": 14.3096,
    "WBGTmax": 15.9688,
    "WBGTmaxSun": 17.5687,
    "UTCImin": 13.5998,
    "UTCImean": 16.1949,
    "UTCImax": 18.5757,
    "HImin": 12.2142,
    "HImean": 15.2067,
    "HImax": 17.9783
  },
  {
    "Year": 1981,
    "Month": 4,
    "Tmin": 10,
    "Tmean": 12.7361,
    "Tmax": 15.8571,
    "Td": 9.64087,
    "RHmean": 82.5259,
    "RHmax": 67.9274,
    "WBGTmin": 10.0824,
    "WBGTmean": 11.6051,
    "WBGTmax": 13.5108,
    "WBGTmaxSun": 14.592,
    "UTCImin": 10.9405,
    "UTCImean": 13.3256,
    "UTCImax": 15.999,
    "HImin": 9.51275,
    "HImean": 12.2205,
    "HImax": 15.2729
  },
  {
    "Year": 1981,
    "Month": 5,
    "Tmin": 7.77419,
    "Tmean": 10.0627,
    "Tmax": 13.6129,
    "Td": 5.78494,
    "RHmean": 75.9491,
    "RHmax": 61.0582,
    "WBGTmin": 7.20217,
    "WBGTmean": 8.64684,
    "WBGTmax": 10.9509,
    "WBGTmaxSun": 11.6187,
    "UTCImin": 8.33175,
    "UTCImean": 10.4036,
    "UTCImax": 13.5211,
    "HImin": 6.89413,
    "HImean": 9.10776,
    "HImax": 12.6245
  },
  {
    "Year": 1981,
    "Month": 7,
    "Tmin": 4.9,
    "Tmean": 7.17407,
    "Tmax": 10.3667,
    "Td": 2.70556,
    "RHmean": 74.8556,
    "RHmax": 61.1368,
    "WBGTmin": 4.34986,
    "WBGTmean": 5.8641,
    "WBGTmax": 7.98966,
    "WBGTmaxSun": 8.615,
    "UTCImin": 5.264,
    "UTCImean": 7.39827,
    "UTCImax": 10.2977,
    "HImin": 3.69173,
    "HImean": 5.90138,
    "HImax": 9.05522
  },
  {
    "Year": 1981,
    "Month": 8,
    "Tmin": 4.45161,
    "Tmean": 7.92652,
    "Tmax": 11.871,
    "Td": 0.390681,
    "RHmean": 61.2032,
    "RHmax": 47.431,
    "WBGTmin": 3.40579,
    "WBGTmean": 5.77148,
    "WBGTmax": 8.40882,
    "WBGTmaxSun": 9.3788,
    "UTCImin": 4.54988,
    "UTCImean": 7.83204,
    "UTCImax": 11.4088,
    "HImin": 2.9492,
    "HImean": 6.37245,
    "HImax": 10.352
  },
  {
    "Year": 1981,
    "Month": 9,
    "Tmin": 4.2,
    "Tmean": 8.3537,
    "Tmax": 10.8667,
    "Td": 5.32407,
    "RHmean": 81.6902,
    "RHmax": 69.417,
    "WBGTmin": 5.1251,
    "WBGTmean": 7.35119,
    "WBGTmax": 9.0068,
    "WBGTmaxSun": 10.4248,
    "UTCImin": 4.87588,
    "UTCImean": 8.78665,
    "UTCImax": 11.0342,
    "HImin": 3.20796,
    "HImean": 7.37767,
    "HImax": 9.82164
  },
  {
    "Year": 1981,
    "Month": 10,
    "Tmin": 7.48387,
    "Tmean": 11.0681,
    "Tmax": 13.6774,
    "Td": 7.32616,
    "RHmean": 78.8369,
    "RHmax": 67.1361,
    "WBGTmin": 7.72401,
    "WBGTmean": 9.77781,
    "WBGTmax": 11.4299,
    "WBGTmaxSun": 13.2976,
    "UTCImin": 8.26469,
    "UTCImean": 11.5077,
    "UTCImax": 13.7745,
    "HImin": 6.74846,
    "HImean": 10.2892,
    "HImax": 12.8542
  },
  {
    "Year": 1981,
    "Month": 11,
    "Tmin": 10.1379,
    "Tmean": 13.2088,
    "Tmax": 16.0345,
    "Td": 9.78353,
    "RHmean": 80.1912,
    "RHmax": 67.215,
    "WBGTmin": 10.1662,
    "WBGTmean": 11.9142,
    "WBGTmax": 13.6553,
    "WBGTmaxSun": 15.937,
    "UTCImin": 11.0545,
    "UTCImean": 13.74,
    "UTCImax": 16.1454,
    "HImin": 9.6793,
    "HImean": 12.6796,
    "HImax": 15.4494
  },
  {
    "Year": 1981,
    "Month": 12,
    "Tmin": 12.3262,
    "Tmean": 14.8907,
    "Tmax": 17.3871,
    "Td": 11.7276,
    "RHmean": 81.5082,
    "RHmax": 69.7501,
    "WBGTmin": 12.1564,
    "WBGTmean": 13.6467,
    "WBGTmax": 15.1406,
    "WBGTmaxSun": 17.6416,
    "UTCImin": 13.3456,
    "UTCImean": 15.5432,
    "UTCImax": 17.6521,
    "HImin": 12.0881,
    "HImean": 14.5641,
    "HImax": 17.0036
  },
  {
    "Year": 1982,
    "Month": 0,
    "Tmin": 7.17557,
    "Tmean": 11.1063,
    "Tmax": 14.9062,
    "Td": 6.62961,
    "RHmean": 74.9441,
    "RHmax": 59.1579,
    "WBGTmin": 7.3061,
    "WBGTmean": 9.60836,
    "WBGTmax": 12.0246,
    "WBGTmaxSun": 13.5322,
    "UTCImin": 7.93259,
    "UTCImean": 11.4494,
    "UTCImax": 14.7667,
    "HImin": 6.40302,
    "HImean": 10.2599,
    "HImax": 14.0271
  },
  {
    "Year": 1982,
    "Month": 1,
    "Tmin": 10.3389,
    "Tmean": 14.1222,
    "Tmax": 17.5019,
    "Td": 10.3722,
    "RHmean": 78.3829,
    "RHmax": 63.6444,
    "WBGTmin": 10.5689,
    "WBGTmean": 12.6951,
    "WBGTmax": 14.7305,
    "WBGTmaxSun": 17.1905,
    "UTCImin": 11.3631,
    "UTCImean": 14.632,
    "UTCImax": 17.5026,
    "HImin": 9.92938,
    "HImean": 13.6372,
    "HImax": 16.9704
  },
  {
    "Year": 1982,
    "Month": 2,
    "Tmin": 12.248,
    "Tmean": 15.379,
    "Tmax": 18.9484,
    "Td": 12.2222,
    "RHmean": 81.5975,
    "RHmax": 65.3673,
    "WBGTmin": 12.3504,
    "WBGTmean": 14.1349,
    "WBGTmax": 16.2461,
    "WBGTmaxSun": 18.365,
    "UTCImin": 13.3921,
    "UTCImean": 16.0678,
    "UTCImax": 19.0792,
    "HImin": 12.0642,
    "HImean": 15.1036,
    "HImax": 18.6068
  },
  {
    "Year": 1982,
    "Month": 3,
    "Tmin": 10.6264,
    "Tmean": 14.567,
    "Tmax": 18.228,
    "Td": 10.5268,
    "RHmean": 77.2457,
    "RHmax": 61.7686,
    "WBGTmin": 10.8023,
    "WBGTmean": 13.0499,
    "WBGTmax": 15.2515,
    "WBGTmaxSun": 16.8514,
    "UTCImin": 11.6506,
    "UTCImean": 15.059,
    "UTCImax": 18.1618,
    "HImin": 10.2382,
    "HImean": 14.0968,
    "HImax": 17.7203
  },
  {
    "Year": 1982,
    "Month": 4,
    "Tmin": 8.28927,
    "Tmean": 12.3774,
    "Tmax": 16.6935,
    "Td": 7.12836,
    "RHmean": 71.6036,
    "RHmax": 54.429,
    "WBGTmin": 8.07749,
    "WBGTmean": 10.5633,
    "WBGTmax": 13.249,
    "WBGTmaxSun": 14.3302,
    "UTCImin": 9.00788,
    "UTCImean": 12.6247,
    "UTCImax": 16.3256,
    "HImin": 7.55299,
    "HImean": 11.5407,
    "HImax": 15.8404
  },
  {
    "Year": 1982,
    "Month": 5,
    "Tmin": 6.78927,
    "Tmean": 10.3755,
    "Tmax": 14.2874,
    "Td": 6.6705,
    "RHmean": 78.6915,
    "RHmax": 61.921,
    "WBGTmin": 7.05394,
    "WBGTmean": 9.11994,
    "WBGTmax": 11.6353,
    "WBGTmaxSun": 12.3031,
    "UTCImin": 7.54962,
    "UTCImean": 10.7974,
    "UTCImax": 14.2113,
    "HImin": 5.98517,
    "HImean": 9.52347,
    "HImax": 13.389
  },
  {
    "Year": 1982,
    "Month": 6,
    "Tmin": 4.53704,
    "Tmean": 8.02778,
    "Tmax": 12.8556,
    "Td": 1.36296,
    "RHmean": 63.9868,
    "RHmax": 46.6503,
    "WBGTmin": 3.75934,
    "WBGTmean": 6.06368,
    "WBGTmax": 9.27825,
    "WBGTmaxSun": 9.8104,
    "UTCImin": 4.75433,
    "UTCImean": 8.01639,
    "UTCImax": 12.3611,
    "HImin": 3.1271,
    "HImean": 6.55658,
    "HImax": 11.4148
  },
  {
    "Year": 1982,
    "Month": 7,
    "Tmin": 3.00896,
    "Tmean": 6.69176,
    "Tmax": 11.5233,
    "Td": 0.281363,
    "RHmean": 65.0132,
    "RHmax": 47.4322,
    "WBGTmin": 2.50418,
    "WBGTmean": 4.87147,
    "WBGTmax": 8.14736,
    "WBGTmaxSun": 8.7727,
    "UTCImin": 3.12808,
    "UTCImean": 6.64994,
    "UTCImax": 11.0682,
    "HImin": 1.4728,
    "HImean": 5.11363,
    "HImax": 9.96959
  },
  {
    "Year": 1982,
    "Month": 8,
    "Tmin": 3.89074,
    "Tmean": 8.25926,
    "Tmax": 11.8352,
    "Td": 4.6963,
    "RHmean": 78.8587,
    "RHmax": 62.6882,
    "WBGTmin": 4.70963,
    "WBGTmean": 7.12274,
    "WBGTmax": 9.46413,
    "WBGTmaxSun": 10.4341,
    "UTCImin": 4.53797,
    "UTCImean": 8.6311,
    "UTCImax": 11.8118,
    "HImin": 2.82464,
    "HImean": 7.1998,
    "HImax": 10.7114
  },
  {
    "Year": 1982,
    "Month": 9,
    "Tmin": 5.52778,
    "Tmean": 9.90556,
    "Tmax": 13.4352,
    "Td": 5.8963,
    "RHmean": 76.7366,
    "RHmax": 61.2182,
    "WBGTmin": 5.94218,
    "WBGTmean": 8.55935,
    "WBGTmax": 10.8363,
    "WBGTmaxSun": 12.2543,
    "UTCImin": 6.25308,
    "UTCImean": 10.2701,
    "UTCImax": 13.3514,
    "HImin": 4.66327,
    "HImean": 8.95547,
    "HImax": 12.4332
  },
  {
    "Year": 1982,
    "Month": 10,
    "Tmin": 4.80159,
    "Tmean": 10.1171,
    "Tmax": 13.8651,
    "Td": 4.42659,
    "RHmean": 70.1723,
    "RHmax": 55.4714,
    "WBGTmin": 5.06719,
    "WBGTmean": 8.30009,
    "WBGTmax": 10.719,
    "WBGTmaxSun": 12.5867,
    "UTCImin": 5.37704,
    "UTCImean": 10.2803,
    "UTCImax": 13.5843,
    "HImin": 3.73974,
    "HImean": 9.01666,
    "HImax": 12.756
  },
  {
    "Year": 1982,
    "Month": 11,
    "Tmin": 8.21839,
    "Tmean": 11.5766,
    "Tmax": 14.4866,
    "Td": 7.87931,
    "RHmean": 78.7804,
    "RHmax": 65.8273,
    "WBGTmin": 8.29848,
    "WBGTmean": 10.2893,
    "WBGTmax": 12.1182,
    "WBGTmaxSun": 14.3999,
    "UTCImin": 9.03572,
    "UTCImean": 12.0431,
    "UTCImax": 14.5568,
    "HImin": 7.56246,
    "HImean": 10.8471,
    "HImax": 13.7102
  },
  {
    "Year": 1982,
    "Month": 12,
    "Tmin": 8.25269,
    "Tmean": 12.2079,
    "Tmax": 15.5358,
    "Td": 8.49641,
    "RHmean": 78.2601,
    "RHmax": 63.4765,
    "WBGTmin": 8.53918,
    "WBGTmean": 10.8732,
    "WBGTmax": 12.944,
    "WBGTmaxSun": 15.445,
    "UTCImin": 9.14154,
    "UTCImean": 12.6763,
    "UTCImax": 15.5241,
    "HImin": 7.67627,
    "HImean": 11.528,
    "HImax": 14.8032
  }
];

function averages({
  avg,
  n
}, tempInfo) {
  if (tempInfo.WBGTmaxSun == null) {
    return {
      avg,
      n
    };
  }

  return {
    avg: (tempInfo.WBGTmaxSun + n * avg) / (n + 1),
    n: n + 1,
  };
}

// Calculations
// ----------------------------------------------------------------------------

let result = {};

array1.forEach(({Year, Month, ...temps}) => {
  Object.entries(temps).forEach(([type, temp]) => {
    if (temp === null) { // skip null values
      return;
    }
    // Add entry for temperature type of it doesn't exist
    if (!(type in result)) {
      result[type] = [];
    }
    // Use month as array index within type
    if (result[type][Month]) {
      result[type][Month].push(temp);
    } else {
      result[type][Month] = [temp];
    }
  });
});

console.log(result);


问:
Keeping forward slashes in cookie PHP
I am building a log in page.  Right now, there is an expiration on the page that I use a cookie for.  I want the site to redirect back to the page they were on after they log in again.

For this, I use a cookie that has the name of the page stored in it (example, queue.php) and it will take them back.

This method works great if I'm going to a page that is in the same directory, but if I want to go back to a sub-directory, (for example, Deployment/deployment.php) it does not work.

I have tried urlencode(), backslashes, addslashes(), %2F in place of the forward slash, and nothing seems to be working.

This is how I am setting the cookie:

```<code>$url_name = "Deployment/deployment.php";
setcookie("url",$url_name);
</code>```

Any help would be appreciated, I am completely lost.

答:
What exactly doesn't work? As stated in the manual:

Note that the value portion of the cookie will automatically be urlencoded when you send the cookie, and when it is received, it is automatically decoded and assigned to a variable by the same name as the cookie name.

So there's no need to manually encode/decode. I don't think the slash in the $url_name is the problem. I suspect the path you're redirecting to is somehow incorrect, but I can't check without more code.

ContentLicense: CC BY-SA 3.0

Title: Keeping forward slashes in cookie PHP

Body:
I am building a log in page.  Right now, there is an expiration on the page that I use a cookie for.  I want the site to redirect back to the page they were on after they log in again.

For this, I use a cookie that has the name of the page stored in it (example, queue.php) and it will take them back.

This method works great if I'm going to a page that is in the same directory, but if I want to go back to a sub-directory, (for example, Deployment/deployment.php) it does not work.

I have tried urlencode(), backslashes, addslashes(), %2F in place of the forward slash, and nothing seems to be working.

This is how I am setting the cookie:

$url_name = "Deployment/deployment.php";
setcookie("url",$url_name);

Any help would be appreciated, I am completely lost.


问:
Count how many times any value appears in a combination of columns but not in other columns (pandas)
I have a data set that looks like this:

```<code>A   B   C
1   2
    3   4
1       5
1   2   4
1       2
1
</code>```

I want to return the amount of times any value appears in a combination of two columns but not the third column. The numeric values in this case are arbitrary. I just care about counting instances.

In other words:

1.) How many times does any value appear in column A and column B but not column C?

2.) How many times does any value appear in column B and column C but not column A?

3.) How many times does any value appear in column A and column C but not in column B?

My expected answers based on the mock data I have given above:

```<code>1.) 1 (row 1)
2.) 1 (row 2)
3.) 2 (rows 3 and 5)
</code>```

答:
You could use isna to create a boolean DataFrame. Then filter the rows that have only one NaN value (so that we exclude the last row). Finally sum vertically:

```<code>df_na = df.isna()
df_na[df_na.sum(axis=1).eq(1)].sum()
</code>```

Output:

```<code>A    1
B    2
C    1
dtype: int64
</code>```

Then for example, column "A" doesn't have a value while the other two have values once, "B" doesn't have a value while the other two have twice, etc.

Body:
I have a data set that looks like this:

A   B   C
1   2
    3   4
1       5
1   2   4
1       2
1

I want to return the amount of times any value appears in a combination of two columns but not the third column. The numeric values in this case are arbitrary. I just care about counting instances.

In other words:

1.) How many times does any value appear in column A and column B but not column C?

2.) How many times does any value appear in column B and column C but not column A?

3.) How many times does any value appear in column A and column C but not in column B?

My expected answers based on the mock data I have given above:

1.) 1 (row 1)
2.) 1 (row 2)
3.) 2 (rows 3 and 5)

Body:
You could use isna to create a boolean DataFrame. Then filter the rows that have only one NaN value (so that we exclude the last row). Finally sum vertically:

df_na = df.isna()
df_na[df_na.sum(axis=1).eq(1)].sum()

Output:

A    1
B    2
C    1
dtype: int64

Then for example, column "A" doesn't have a value while the other two have values once, "B" doesn't have a value while the other two have twice, etc.


问:
Incrementing json value of a key in ruby?
I'm looking for a way to increment the values of keys foo and bar

```<code>{
  "users": [
    {
      "foo": 6522
    },
    {
      "bar": 20
    }
  ]
}
</code>```

Here is an example of what I attempted, however the result leaves the values unchanged.

```<code>data = JSON.parse(filepath\info.json)

puts data["users"][1].values[0] # 20

data["users"][1].values[0] += 5

puts data["users"][1].values[0] # remains 20, but expected 25
</code>```

Is there another way to increment these values?

答:
You'll need to know the key to increment in the user. Since it looks like it's different some times, you can achieve this with 2 eachs

```<code>data[:users].each {|u| u.keys.each {|k| u[k] += 1 } }
</code>```

Iterate over the users, then iterate over the keys in the user object, adding 1.

This assumes only one key is in users and it's an integer.

values returns a new array so you won't be able to use it that way.

Body:
I'm looking for a way to increment the values of keys foo and bar

{
  "users": [
    {
      "foo": 6522
    },
    {
      "bar": 20
    }
  ]
}

Here is an example of what I attempted, however the result leaves the values unchanged.

data = JSON.parse(filepath\info.json)

puts data["users"][1].values[0] # 20

data["users"][1].values[0] += 5

puts data["users"][1].values[0] # remains 20, but expected 25

Is there another way to increment these values?

Body:
You'll need to know the key to increment in the user. Since it looks like it's different some times, you can achieve this with 2 eachs

data[:users].each {|u| u.keys.each {|k| u[k] += 1 } }

Iterate over the users, then iterate over the keys in the user object, adding 1.

This assumes only one key is in users and it's an integer.

values returns a new array so you won't be able to use it that way.