0

I'm playing around with some Covid data so I can practice my Tableau skills.

The first five columns are categorical (['Acute?' 'NHS England Region' 'Code' 'Name'] while the remaining are the data - datetime.

I want to transform the dates as rows along with the categoricals as columns. Tried set_index but that didn't get results and thought I would try to stack the datetime columns but it doesn't work.

Ideally I want this. Any ideas?

           Type 1 Acute?  NHS England Region      Code  Name
2020-08-01 No             East of England.        8D379 CARETECH COMMUNITY SERVICES
   

This is broadly the shape. I've dropped the date columns but there are 250 columns.

Type 1 Acute?   NHS England Region  Code    Name    2020-08-01 00:00:00 2020-08-02 00:00:00 2020-08-03 00:00:00 2020-08-04 00:00:00 2020-08-05 00:00:00 2020-08-06 00:00:00 ... 2021-03-28 00:00:00 2021-03-29 00:00:00 2021-03-30 00:00:00 2021-03-31 00:00:00 2021-04-01 00:00:00 2021-04-02 00:00:00 2021-04-03 00:00:00 2021-04-04 00:00:00 2021-04-05 00:00:00 2021-04-06 00:00:00
9   No  East of England 8D379   CARETECH COMMUNITY SERVICES LTD 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
10  No  East of England AND01   BADDOW HOSPITAL 0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 NaN NaN
11  No  East of England AVQ03   ONE HATFIELD HOSPITAL   0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 NaN NaN
12  No  East of England AWR01   ONE STOP DOCTORS LTD (ONE MEDICAL HOUSE)    0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 NaN NaN
13  No  East of England DE8 ELYSIUM HEALTHCARE  0.0 0.0 0.0 0.0 0.0 0.0 ... 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0
elksie5000
  • 7,084
  • 12
  • 57
  • 87

0 Answers0