简体   繁体   中英

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. 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.

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()

可视化

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM