这是我的数据样本
day month year Temperature RH ... DC ISI BUI FWI Classes
0 1 6 2012 29 57 ... 7.6 1.3 3.4 0.5 not fire
1 2 6 2012 29 61 ... 7.6 1 3.9 0.4 not fire
2 3 6 2012 26 82 ... 7.1 0.3 2.7 0.1 not fire
3 4 6 2012 25 89 ... 6.9 0 1.7 0 not fire
4 5 6 2012 27 77 ... 14.2 1.2 3.9 0.5 not fire
.. .. ... ... ... .. ... ... ... ... ... ...
242 26 9 2012 30 65 ... 44.5 4.5 16.9 6.5 fire
243 27 9 2012 28 87 ... 8 0.1 6.2 0 not fire
244 28 9 2012 27 87 ... 7.9 0.4 3.4 0.2 not fire
这是我绘制散点图的代码,显示哪个温度会引起火灾
# Importing libraries
import pandas as pd
from IPython.display import display
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
# Load the data
# Variable forest is to reps dataframe.
forest = pd.read_csv('ForestFireUp.csv')
print(">>>>>DATA>>>>>")
display(forest)
# Basic information
print(">>>>>INFO>>>>>")
forest.info()
forest.replace(np.nan, '0', inplace = True)
forest.isnull().sum()
# Describe the data
print(">>>>>DESCRIBE>>>>>")
print(forest.describe())
# drop duplicate data
print(">>>>>SUBSETS>>>>>")
temp_data = forest[['Temperature']]
print(temp_data)
print(temp_data.describe())
tempUnique = forest['Temperature'].unique()
tempCount = forest['Temperature'].count()
print(tempUnique)
print(tempCount)
cat_data= forest.Classes.value_counts(normalize = True)
class_data =['not fire', 'fire']
print(cat_data)
y = class_data
x = temp_data
plt.scatter(x, y)
plt.ylabel("Classes")
plt.xlabel("Temperature")
plt.show()