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
  How to find difference between two timestamp index python_newbie09 3 1,421 Aug-01-2019, 10:24 AM
Last Post: python_newbie09
  Averaging data while merging SujaiBanerji 0 454 Jul-18-2019, 04:20 AM
Last Post: SujaiBanerji
  How to create a dataframe from timestamp values MohanReddy 5 976 Mar-20-2019, 09:11 AM
Last Post: samsonite

Forum Jump:

User Panel Messages

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