0

]Im trying to turn all the values in the 'Data' column into multiple records. The Interval and Count represent how many readings after the initial reading. So 8 readings after 23:30 (1130 pm) at 30 mins each. I need to incorporate the correct time for that reading into its own record. So I need a record at 11:30 with a value of 10, 0.09045, I need a record for 12am with a value of 10, 0.08595, 1230 am with a value of 10, 0.08865 etc. All while maintaining the same data other than the fields mentioned.

Ive tried explode but cant seem to get the results Im looking for.

EDIT:

The Data is set up like this:

R Type,R Version, Time Stamp, Eid, Units, Interval, Count, FirstInt, Data

MEID, 2000, 700016565, Dollar General, kwh, 30, 8, 10-31-2022 23:30:00Z, (Data Field)10, 0.095, 10,0.88,10,0.075,10,0.0918,10,0.0945,10,0.09495,10,0.0945, 10, .1008

The Data field has 8 readings starting at 23:30:00z with a value of 10,0.095.

I need to turn that into below:

R Type,R Version, Time Stamp, Eid, Units, Interval, Count, FirstInt, Data

1: MEID, 2000, 700016565, Dollar General, kwh, 30, 8, 10-31-2022 23:30:00Z, 10, 0.095

2: MEID, 2000, 700016565, Dollar General, kwh, 30, 8, 11-1-2022 12:00:00Z, 10,0.88

3: MEID, 2000, 700016565, Dollar General, kwh, 30, 8, 11-1-2022 12:30:00Z, 10,0.075

3: MEID, 2000, 700016565, Dollar General, kwh, 30, 8, 11-1-2022 1:00:00Z, 10,0.0918

4: MEID, 2000, 700016565, Dollar General, kwh, 30, 8, 11-1-2022 1:30:00Z, 10,0.918

5: MEID, 2000, 700016565, Dollar General, kwh, 30, 8, 11-1-2022 2:00:00Z, 10,0.0945

6: MEID, 2000, 700016565, Dollar General, kwh, 30, 8, 11-1-2022 2:30:00Z, 10,0.09495

7: MEID, 2000, 700016565, Dollar General, kwh, 30, 8, 11-1-2022 3:00:00Z, 10,0.0945

3: MEID, 2000, 700016565, Dollar General, kwh, 30, 8, 11-1-2022 3:30:00Z, 10,0.1008

  • The question is quite vague, please provide an explicit minimal reproducible example and the matching expected output. – mozway Dec 07 '22 at 21:39
  • Please provide enough code so others can better understand or reproduce the problem. – Community Dec 07 '22 at 22:49
  • your question needs a minimal reproducible example consisting of sample input, expected output, actual output, and only the relevant code necessary to reproduce the problem. See [How to make good reproducible pandas examples](https://stackoverflow.com/questions/20109391/how-to-make-good-reproducible-pandas-examples) for best practices related to Pandas questions. – itprorh66 Dec 08 '22 at 14:31

0 Answers0