Vijay Kumar
Vijay Kumar

Reputation: 11

Data preparation to convert two date field in one

I have two date columns having corresponding Dollars associated in two other column. I want to plot it in single chart, but for that data preparation in required in python.

Actual table

StartDate start$ EndDate End$
5 June 500 7 June 300
7 June 600 10 June 550
8 june 900 10 June 600

Expected Table

PythonDate start$ End$
5 June 500 0
6 june 0 0
7 June 600 300
8 June 900 0
9 June 0 0
10June 0 1150

Any solution in Python?

Upvotes: 0

Views: 42

Answers (1)

Sai Pardhu
Sai Pardhu

Reputation: 289

I can suggest you a basic logic, you figure out how to do it. It's not difficult to do it and it'll be a good learning too:

You can read only the subset of columns you need from the input table as a single dataframe. Make such two dataframes with value as 0 for the column that you be missing and then append them together.

Upvotes: 1

Related Questions