import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline
import seaborn as sns
import warnings
warnings.filterwarnings('ignore')
''' reading dataset '''
df = pd.read_excel('Wine_Production_by_country.xlsx')
''' displaying first five rows of data '''
df.head()
''' shape of data '''
df.shape
''' checking null values '''
df.isnull().sum()
''' info of data '''
df.info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 120 entries, 0 to 119
Data columns (total 3 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 Country 120 non-null object
1 Year 120 non-null int64
2 Wine production in mhl 120 non-null float64
dtypes: float64(1), int64(1), object(1)
memory usage: 2.9+ KB
''' column nmaes '''
df.columns
''' value couns of country '''
plt.figure(figsize=(10, 5))
sns.barplot(df['Country'].value_counts(), df['Country'].value_counts().index);
plt.ylabel('Counry', fontsize=15);
plt.xlabel('count', fontsize=15);
''' converting year column into date time '''
df.Year = pd.to_datetime(df['Year'])
''' histogra plot '''
for feature in ['Year', 'Wine production in mhl']:
plt.figure(figsize=(10, 5))
sns.histplot(df[feature])
plt.title('Histogram plot of {}'.format(feature));
plt.figure(figsize=(10,8))
plt.xticks(rotation=90)
sns.barplot(df['Year'], df["Wine production in mhl"])
plt.xlabel('Year', fontsize=15)
plt.ylabel('Wine production in mhl', fontsize=15);
''' pie chart '''
df['Country'].value_counts().plot(kind='pie', figsize=(10,10), autopct="%1.2f%%")
plt.title("Country Pie");
df_h= df.loc[df["Wine production in mhl"] == 2.3]
df_h
df_h['Country'].value_counts().plot(kind='pie', figsize=(10,10), autopct="%1.2f%%")
plt.title("Country Pie");