[英]X and Y must have same first dimension, but have shapes (nan,) and (nan,)
I've received this error when trying to visualize a large CSV file.我在尝试可视化大型 CSV 文件时收到此错误。 Attached is the head for the data file.
附件是数据文件的头部。 Any suggestions would be great the file is just a bunch of prime numbers and where they are in the list.
任何建议都会很棒,该文件只是一堆质数以及它们在列表中的位置。 Head .
头。 The csv file is also linked.
csv 文件也已链接。
https://drive.google.com/file/d/1qHzops9jJeMNPhExmebCCvrNGQjJF8aN/view?usp=sharing https://drive.google.com/file/d/1qHzops9jJeMNPhExmebCCvrNGQjJF8aN/view?usp=sharing
so I decided to implement it in a simple way with modules that I'm familiar with, Please do consider showing us your code in order to figure out what did gone wrong.所以我决定用我熟悉的模块以一种简单的方式实现它,请考虑向我们展示你的代码,以便找出哪里出了问题。
import matplotlib.pyplot as plt
import pandas as pd
if __name__=="__main__":
df = pd.read_csv('50_million_primes_0.csv')
X = df.Num
Y = df.Prime
print(Y)
# Plot lines and/or markers to the Axes.
plt.plot(X, Y)
# Set the x axis label of the current axis.
plt.xlabel('Num')
# Set the y axis label of the current axis.
plt.ylabel('Prime')
# Set a title
plt.title('Draw a line.')
# Display the figure.
plt.show()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.