New answers tagged

0

I copied the user, rafaelvalle's code: # Find Elbow Point, Trade off Point def elbow_point(data): curve = data nPoints = len(curve) allCoord = np.vstack((range(nPoints), curve)).T np.array([range(nPoints), curve]) firstPoint = allCoord[0] lineVec = allCoord[-1] - allCoord[0] lineVecNorm = lineVec / np.sqrt(np.sum(lineVec**2)) ...


0

Your current solution is fine, but it computes the counts multiple times. It's more efficient to compute once and store the result: # compute once complaints = npy_dataframe["Complaint Type"].value_counts().head() # reuse result ax.bar(x=complaints.index, height=complaints) ax.axhline(y=complaints.mean(), linestyle="--") Or use the data ...


1

Only this line is solved the error ax.bar(npy_dataframe["Complaint Type"].value_counts().head().keys(),npy_dataframe["Complaint Type"].value_counts().head())


Top 50 recent answers are included