I have 3
station names having the name ASD, AFD and CDF
respectively(column-1). And each station has started recording the data from a day to another day(column 2 and 3)
.however in some days data recording has stopped because of power issue of the sensor, so there is gaps in the data (column 4 and 5)
I want to plot the data recording of each station from 2014-01-01 to 2019-01-01 and data gaps which is given below for each station input.csv
station data_recording_start data_recording_end data_recording_stopped_from data_recording_stopped_to
ASD 2014-01-01T00:12:00 2019-01-01T00:12:00 nan nan
ASD 2014-01-01T00:12:00 2019-01-01T00:12:00 2015-01-25T00:12:00 2015-01-28T00:12:00
ASD 2014-01-01T00:12:00 2019-01-01T00:12:00 2015-01-25T00:12:00 2015-01-28T00:12:00
AFD 2015-01-01T13:12:00 2019-01-01T00:12:00 2015-01-25T00:12:00 2015-01-28T00:12:00
AFD 2015-01-01T13:12:00 2019-01-01T00:12:00 2015-01-25T00:12:00 2015-01-28T00:12:00
AFD 2015-01-01T13:12:00 2019-01-01T00:12:00 2015-01-25T00:12:00 2015-01-28T00:12:00
CDF 2018-01-01T00:12:00 2019-01-01T00:12:00 2015-01-25T00:12:00 2015-01-28T00:12:00
CDF 2018-01-01T00:12:00 2019-01-01T00:12:00 2015-01-25T00:12:00 2015-01-28T00:12:00
CDF 2018-01-01T00:12:00 2019-01-01T00:12:00 2015-01-25T00:12:00 2015-01-28T00:12:00
I want to plot a chart where the x -axis should contain the month and year and y -axis should contain the stations name. My plot should looks like this
I tried this script but it doesnot help me doing this work
import matplotlib.pylab as plt
import datetime
from matplotlib import dates as mdates
import pandas as pd
import numpy as np
df = pd.read_csv('input.csv', header = 0,delimiter=r"\s+")
df.set_index('station').plot();
n = 3 # number of stations
df['Date'] = pd.to_datetime(df['station'])
After that i am unable to proceed as i am new to python and i didnot get any answer from pandas community and matplotlib, i hope experts may help me on this kind of plot.Thanks in advance.