Python Forum
Data merging & Timestamp
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Data merging & Timestamp
#1
Hi,

New using Python, I can code simple stuff in several languages but I’m far from being an expert.
Here is my current situation:

I have 2 Dataframes:

DF1: (3 columns)

Timestamp (fred 10min) / A,B,C,D / Values
8/1/2020 0:10 / A / 26
8/1/2020 0:20 / A / 37
8/1/2020 0:20 / B / 54
8/1/2020 0:30 / B / 78


DF2 (10 columns)

A,B,C,D / Start date / End date / Other column 1 / Other column 2 / Other column n
A / 8/10/2020 11:32 / 8/1/2020 11:42 / To / Be / saved
A / 8/13/2020 0:20 / 8/15/2020 0:24 / To / Be / saved
B / 8/23/2020 0:23 / 8/23/2020 11:31 / To / Be / saved
B / 8/11/2020 15:20 / 8/1/2020 17:20 / To / Be / saved


I would like to
1. Create Timestamps (freq 10min) from the periods of time between ‘Start date’ and ‘End date’ in DF2
AND duplicate the values associated to the period of time (1 line before) to the newly created lines (1 line / time stamp (freq 10min))

Timestamp (fred 10min) / A,B,C,D / Other column 1 / Other column 2 / Other column n
8/10/2020 11:30 / A / To / Be / saved
8/10/2020 11:40 / A / To / Be / saved
8/13/2020 0:20 / B / TO / BE / SAVED
8/13/2020 0:30 / B / TO / BE / SAVED


2. Merge DF1 and DF2 (on Timestamp) to get

Timestamp (fred 10min) / A,B,C,D / Values / Other column 1 / Other column 2 / Other column n
8/10/2020 11:30 / A / 265 / To / Be / saved
8/10/2020 11:40 / A / 71 / To / Be / saved
8/1/2020 0:20 / B / 54 / / /
8/1/2020 0:20 / B / 78 / / /
8/13/2020 0:20 / B / 29 / TO / BE / SAVED
8/13/2020 0:30 / B / 83 / TO / BE / SAVED


To get those 2 DF I used panda but I quite stuck now...
Reply
#2
please show what you have tried, and what the problem is, then we will be glad to help
you must make an effort first.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  merging two data frames yk303 1 6,757 Jan-27-2021, 03:02 AM
Last Post: rennerom
  Averaging data while merging SujaiBanerji 0 1,608 Jul-18-2019, 04:20 AM
Last Post: SujaiBanerji

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020