简体   繁体   中英

pandas scatter plot not showing all data

I am new to pandas data visulaizations and I'm having some trouble with a simple scatter plot. I have a dataframe loaded up from a csv, 6 columns, and 137 rows. But when I try to scatter the data from two columns, I only see 20 datapoints in the generated graph. I expected to see all 137. Any suggestions?

Here is a tidbit of code:

import pandas as pd
import matplotlib.pyplot as plt
plt.style.use('ggplot')
df = pd.read_csv(file, sep=',', header=0)
df.plot.scatter(x="Parte_aerea_peso_fresco", y="APCEi", marker=".")

And here is the output. 在此处输入图片说明

Possibility 1) Many points are on exactly the same spot. You can manually check in your file.csv

Possibility 2) Some value are not valid ie : NaN ( not a number ) or a string, ...

Your dataframe is small: You can check this possibility by printing your DataFrame.

print (df)   
print (df[40:60])    
df.describe()

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