我有一个要绘制的数据框。
我正在使用以下代码:
def vizData3D(df, asg, dueDate):
due_final = datetime.datetime.strptime(dueDate, "%Y-%m-%d")
df['Time of Last Submission'] = pd.to_datetime(df['Time of Last Submission'], errors='coerce')
start = due_final - datetime.timedelta(days=15)
end = df['Time of Last Submission'].max() + datetime.timedelta(days=1)
mask = (start < df['Time of Last Submission'])
df = df.loc[mask]
df.set_index('Student')
df['Num Lines Last Attempt'] = df['Num Lines Last Attempt'].apply(pd.to_numeric)
fig = plt.figure()
ax = fig.add_subplot(111, projection='3d')
x = df['Num Lines Last Attempt']
y = df['Time of Last Submission']
z = df['Total attempts']
#print(df[df['Num Lines Last Attempt'] < 0].count())
ax.scatter(x, y, z, c='r', marker='o')
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
plt.show()
当我尝试运行此程序时,出现错误:
ValueError: view limit minimum -0.05 is less than 1 and is an invalid Matplotlib date value. This often happens if you pass a non-datetime value to an axis that has datetime units
这没有任何意义。我在其他2D图中绘制了所有这些数据,并且它们起作用了。关于测试错误或修复方法的任何建议?有人对此有解决方案吗?