i tried to plot a trend line on a graph using numpy but i got this error
ufunc 'add' cannot use operands with types dtype('<M8[ns]') and dtype('float64')
import pandas as pd
df = pd.read_excel (r'C:\Users\hussa\Downloads\Bo Karar.xlsx',"Data2")
print(df.head())
DataA DataB
0 2022-06-21 02:54:00.761 24.377205
1 2022-06-21 02:54:10.761 24.377205
2 2022-06-21 02:54:20.762 24.377205
3 2022-06-21 02:54:30.762 24.377205
4 2022-06-21 02:54:40.762 24.377205
x=df['DataA']
y=df['DataB']
import matplotlib.pyplot as plt
import numpy as num
%matplotlib inline
fig=plt.figure()
plt.plot(x,y)
z = num.polyfit(x,y, 1)
p = num.poly1d(z)
plt.plot(x, p(x))