[Matplotlib-users] Reshaping Tabular Data to Column Data

Benson, Randall Randall.Benson at avangrid.com
Tue Mar 24 18:12:49 EDT 2020


Hi -
I seem to be stuck here trying to convert downloaded data that is in tabular form since I need to analyze it in single column format. The data is from here and I'm using read_csv as shown below -

pnadata1= pd.read_csv('https://www.esrl.noaa.gov/psd/data/correlation/pna.data')

The downloaded data looks like this with the values in months 1-12 across the columns below for each year 1948-present -

                                    1948        2020
0   1948 -99.90 -99.90 -99.90 -99.90 -99.90 -99.9...
1   1949 -99.90 -99.90 -99.90 -99.90 -99.90 -99.9...
2   1950  -3.65  -1.69  -0.06  -0.23  -0.40  -1.9...
3   1951  -1.18  -2.11  -1.09   0.47   1.19  -0.5...
4   1952  -3.19   0.08  -0.69   0.89  -0.79   0.5...

And, I need it to be reshaped to look like this in yyyymm values format so I can compare it easily to other downloaded data in the column format -

194801 -99.90
194802 -99.90
194803 -99.90
...
202001 -3.45
202002  0.87

I've tried working with "melt" and "group" in different combinations but cannot figure it out given the online references. Thank you,
Randall


[Description: cid:image001.jpg at 01D34737.23261CB0]
Randall P. Benson, PhD
Wind Asset Meteorologist, Energy Resource - Onshore

1125 NW Couch Street, Suite 700
Portland, Oregon, USA 97209
Telephone  503-796-7129
Cell  971-227-2477
randall.benson at avangrid.com<mailto:randall.benson at avangrid.com>

[Description: cid:image002.png at 01D34737.23261CB0]

In the interest of the environment,
please print only if necessary and recycle.




==============================================================
  
Please consider the environment before printing this email.

If you have received this message in error, please notify the sender and immediately delete this message and any attachment hereto and/or copy hereof, as such message contains confidential information intended solely for the individual or entity to whom it is addressed. The use or disclosure of such information to third parties is prohibited by law and may give rise to civil or criminal liability.

The views presented in this message are solely those of the author(s) and do not necessarily represent the opinion of Avangrid Renewables, LLC. or any company of its group. Neither Avangrid Renewables, LLC. nor any company of its group guarantees the integrity, security or proper receipt of this message. Likewise, neither Avangrid Renewables, LLC. nor any company of its group accepts any liability whatsoever for any possible damages arising from, or in connection with, data interception, software viruses or manipulation by third parties.

 ==============================================================
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20200324/00be0b6a/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.jpg
Type: image/jpeg
Size: 45526 bytes
Desc: image001.jpg
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20200324/00be0b6a/attachment-0001.jpg>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image002.png
Type: image/png
Size: 3441 bytes
Desc: image002.png
URL: <http://mail.python.org/pipermail/matplotlib-users/attachments/20200324/00be0b6a/attachment-0001.png>


More information about the Matplotlib-users mailing list