我如何在pycharm 2019 IDE中创建散点图

问题描述 投票:0回答:1
import pandas as pd
import matplotlib.pyplot as plt
pd.set_option('display.max_rows', 500)
pd.set_option('display.max_columns', 500)
pd.set_option('display.width', 1000)
path = "https://s3-api.us-geo.objectstorage.softlayer.net/cf-courses-data/CognitiveClass/DA0101EN/auto.csv"
df = pd.read_csv(path)
headers = ["symboling","normalized-losses","make","fuel-type","aspiration", "num-of-doors","body-style",
         "drive-wheels","engine-location","wheel-base", "length","width","height","curb-weight","engine-type",
         "num-of-cylinders", "engine-size","fuel-system","bore","stroke","compression-ratio","horsepower",
         "peak-rpm","city-mpg","highway-mpg","price"]
df.columns = headers
y = df["price"]
x = df["engine-size"]
plt.xlabel("engine")
plt.ylabel("price")
plt.title("Price Vs Engine size")
plt.scatter(x, y)

在此之后,我得到了“退出代码为0的文字,并且看不到任何散点图] >>

将pandas作为pd导入matplotlib.pyplot作为plt pd.set_option('display.max_rows',500)pd.set_option('display.max_columns',500)pd.set_option('display.width',1000)path = “ https://s3-api.us-geo ....

python pandas matplotlib pycharm scatter-plot
1个回答
0
投票

您是否尝试过使用plt.show()作为结尾?

© www.soinside.com 2019 - 2024. All rights reserved.