私は以下のフォーマットのパンダデータフレームを持っています。私はこのコードを試みたが、完璧な結果が得られていないようです0と1パンダデータフレームの値の散布図
Distance ClusterAssigned
23 1
35 1
20 1
264 0
830 0
ため、おそらく異なる色で、ClusterAssignedに基づいて、このデータをプロットしようとしています。
groups = dfprintscatter.groupby('ClusterAssigned')
import matplotlib.pyplot as plt
fig, ax = plt.subplots()
ax.margins(0.05)
for name, group in groups:
ax.plot(group.Distance, group.ClusterAssigned, marker='o', linestyle='', ms=5, label=name)
ax.legend()
plt.show()
使用していますか? – piRSquared