Pycharm绘制图形

Example 1
1
2
3
4
import matplotlib.pyplot as plt
x = range(10)
plt.plot(x, x)
plt.show()


Example 2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import pandas as pd
import matplotlib.pyplot as plt
print(pd.__version__)
city_names = pd.Series(['San Francisco', 'San Jose', 'Sacramento'])
population = pd.Series([3, 6, 9])

df = pd.DataFrame({ 'City name': city_names, 'Population': population })

population.plot()
plt.show()

california_housing_dataframe = pd.read_csv("/Users/Downloads/california_housing_train.csv", sep=",")
# print(california_housing_dataframe.describe())
# print(california_housing_dataframe.head())
california_housing_dataframe.hist('housing_median_age')

plt.show()

series image
dataframe image

分享