Preparing Series from DataFrames and vice versa
In Chapter 5, Data Selection – DataFrames, we saw examples of getting a Series by slicing the column of a DataFrame. Let's review this. You have been provided with a dataset (adapted from https://archive.ics.uci.edu/ml/datasets/Water+Treatment+Plant) regarding a water treatment facility and you've been asked to analyze its performance. The data contains various chemical measurements for the input, two settling stages, and the output, plus some performance indicators. We will begin by reading the water-treatment.csv
file. After reading the data, we will use the .fillna()
method, which replaces any missing values, which are converted into NaN
values during the file read, into the value that's passed to .fillna()
. We will use a value of -9999
here:
water_data = pd.read_csv('Datasets\\water-treatment.csv') water_data.fillna(-9999, inplace = True) water_data
Note
Please change the path of the dataset...