Adding a new attribute

Let's add a new attribute, wine_category, to both dataframes. Do you recall how we did that?

Of course, check the example code given as follows:

df_white['wine_category'] = 'white'
df_red['wine_category'] = 'red'

That was easy, right? Next, let's see what are the unique values of the column quality in both types of wines:

print('RED WINE: List of "quality"', sorted(df_red['quality'].unique()))
print('WHITE WINE: List of "quality"', sorted(df_white['quality'].unique()))

The output of the preceding code is given as follows:

RED WINE: List of "quality" [3, 4, 5, 6, 7, 8]
WHITE WINE: List of "quality" [3, 4, 5, 6, 7, 8, 9]

Note that both the red and the white wines have the same unique values for the quality column. 

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.143.237.136