简体   繁体   English

X 和 Y 必须具有相同的第一个维度,但具有 (nan,) 和 (nan,) 形状

[英]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.

相关问题 ValueError:x 和 y 必须具有相同的第一维,但具有形状 (1, 2) 和 (2,) - ValueError: x and y must have same first dimension, but have shapes (1, 2) and (2,) ValueError:x 和 y 必须具有相同的第一维,但具有形状 - ValueError: x and y must have same first dimension, but have shapes x和y必须具有相同的第一尺寸,但形状为(30,)和(1,) - x and y must have same first dimension, but have shapes (30,) and (1,) ValueError:x 和 y 必须具有相同的第一维,但具有形状 (6,) 和 (8,) - ValueError: x and y must have same first dimension, but have shapes (6,) and (8,) 线性回归模型形状 - ValueError:x 和 y 必须具有相同的第一维,但具有形状 (5,) 和 (1, 5) - Linear regression model shapes - ValueError: x and y must have same first dimension, but have shapes (5,) and (1, 5) ValueError: x 和 y 必须具有相同的第一维,但具有形状 (101,) 和 (100,) - ValueError: x and y must have same first dimension, but have shapes (101,) and (100,) x 和 y 必须具有相同的第一维,但具有形状 (50,) 和 (10,) - x and y must have same first dimension, but have shapes (50,) and (10,) ValueError: x 和 y 必须具有相同的第一维,但具有形状 (1,) 和 (224, 224, 3) - ValueError: x and y must have same first dimension, but have shapes (1,) and (224, 224, 3) x 和 y 必须具有相同的第一维,但形状 (40,) 和 (1, 80) 错误 - x and y must have same first dimension, but have shapes (40,) and (1, 80) error 谁能帮我? ValueError:x 和 y 必须具有相同的第一维,但具有形状 (10,) 和 (0,) - Can anyone help me? ValueError: x and y must have same first dimension, but have shapes (10,) and (0,)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM