Create an empty DataFrame with Date Index
Join two columns:
import datetime import pandas as pd todays_date = datetime.datetime.now().date() index = pd.date_range(todays_date, periods=10, freq='D') columns = ['A', 'B', 'C'] df = pd.DataFrame(index=index, columns=columns) df = df.fillna(0) print(df)
C:\pandas>python example42.py A B C 2018-09-30 0 0 0 2018-10-01 0 0 0 2018-10-02 0 0 0 2018-10-03 0 0 0 2018-10-04 0 0 0 2018-10-05 0 0 0 2018-10-06 0 0 0 2018-10-07 0 0 0 2018-10-08 0 0 0 2018-10-09 0 0 0 C:\pandas>
2018-11-24T07:07:13+05:30
2018-11-24T07:07:13+05:30
Amit Arora
Amit Arora
Python Programming Tutorial
Python
Practical Solution