我有这个数据透视表:
<dependency>
<groupId>...</groupId>
<artifactId>child</artifactId>
<version>${project.version}</version>
<type>tar.gz</type>
<classifier>classifier</classifier>
</dependency>
<build>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<id>package-dependencies</id>
<phase>prepare-package</phase>
<goals>
<goal>analyze-only</goal>
</goals>
</execution>
</executions>
</plugin>
</build>
我想创建树状图,并且使用了以下代码:
pivot_p.head()
%_0 %_1 %_2 %_3 %_4
hora_str
00:00 3.69 4.16 3.93 3.50 4.12
01:00 2.65 3.17 3.31 2.47 3.24
02:00 1.85 2.31 2.83 1.81 2.39
03:00 1.40 1.65 2.09 1.34 1.73
04:00 1.12 1.26 1.61 1.18 1.31
然后,要绘制我使用过的数据:
from scipy.cluster.hierarchy import dendrogram, linkage
z = linkage(pivot_p, 'ward')
它似乎起作用,因为我在底部看到了树状图,但是出现了以下错误。关于如何避免该错误的任何想法?
plt.figure(figsize=(25,10))
plt.title('Hierarchical')
plt.xlabel('sample index')
plt.ylabel('distance')
dendrogram(z)