is it np.array is up to you. it can be pandas dataframe or simple list
e.g.
e.g.
import datetime as dt import pandas as pd import matplotlib.pyplot as plt import matplotlib.dates as mdates import random days = mdates.HourLocator(byhour=(0, 12)) # every 12 hours hours = mdates.HourLocator() df = pd.read_excel('data.xlsx') fig, ax = plt.subplots(figsize=(8, 6)) ax.xaxis.set_major_locator(days) ax.xaxis.set_major_formatter(mdates.DateFormatter("%m-%d %H:%M")) ax.xaxis.set_minor_locator(hours) ax.plot(df.x, df.y, 'bo-') ax.set(title='Active Calls', ylabel='Calls', xlabel='Time') ax.grid() ax.xaxis_date() # Default date formatter fig.autofmt_xdate() plt.show()
import datetime as dt import pandas as pd import matplotlib.pyplot as plt import matplotlib.dates as mdates import random df = pd.read_excel('data.xlsx') time = mdates.drange(dt.datetime(2021, 3, 1, 0, 0, 0), dt.datetime(2021, 3, 3, 1, 0, 0), dt.timedelta(hours=6)) fig, ax = plt.subplots(figsize=(8, 6)) plt.xticks(time) ax.xaxis.set_major_formatter(mdates.DateFormatter("%m-%d %H:%M")) ax.plot(df.x, df.y, 'bo-') ax.set(title='Active Calls', ylabel='Calls', xlabel='Time') ax.grid() ax.xaxis_date() # Default date formatter fig.autofmt_xdate() plt.show()
Attached Files
data.xlsx (Size: 5.57 KB / Downloads: 240)
If you can't explain it to a six year old, you don't understand it yourself, Albert Einstein
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs
How to Ask Questions The Smart Way: link and another link
Create MCV example
Debug small programs