Removing lines in a timeseries that represents missing data

15 Views Asked by At

I am trying to display a basic time series but would like to remove the lines in my graph that show where missing dates are in the csv file I have read in. The missing data isnt displayed as nan, rather it isnt there at all in the dataset.

My code is: import numpy as np import pandas as pd import matplotlib.pyplot as plt

df = pd.read_csv('StNicholas.csv')
PM2p5 = df['PM2.5'].to_numpy()
datetime = pd.to_datetime(df['datetime'].array)

plt.plot (datetime,PM2p5)
plt.ylabel('PM2.5 µg/m^3')
plt.xlabel('Month')
plt.tick_params(axis='x', which='major', labelsize=7)

(https://i.stack.imgur.com/TDaW4.png)

havent found a solution yet

0

There are 0 best solutions below