簡體   English   中英

X 和 Y 必須具有相同的第一個維度,但具有 (nan,) 和 (nan,) 形狀

[英]X and Y must have same first dimension, but have shapes (nan,) and (nan,)

我在嘗試可視化大型 CSV 文件時收到此錯誤。 附件是數據文件的頭部。 任何建議都會很棒,該文件只是一堆質數以及它們在列表中的位置。 csv 文件也已鏈接。

https://drive.google.com/file/d/1qHzops9jJeMNPhExmebCCvrNGQjJF8aN/view?usp=sharing

所以我決定用我熟悉的模塊以一種簡單的方式實現它,請考慮向我們展示你的代碼,以便找出哪里出了問題。

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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM