In [1]:
import pandas as pd
from matplotlib import pyplot as plt
import seaborn as sns
In [15]:
df = pd.read_csv("AB_NYC_2019.csv")
In [17]:
df.head()
Out[17]:
id | name | host_id | host_name | neighbourhood_group | neighbourhood | latitude | longitude | room_type | price | minimum_nights | number_of_reviews | last_review | reviews_per_month | calculated_host_listings_count | availability_365 | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 2539 | Clean & quiet apt home by the park | 2787 | John | Brooklyn | Kensington | 40.64749 | -73.97237 | Private room | 149 | 1 | 9 | 19-10-2018 | 0.21 | 6 | 365 |
1 | 2595 | Skylit Midtown Castle | 2845 | Jennifer | Manhattan | Midtown | 40.75362 | -73.98377 | Entire home/apt | 225 | 1 | 45 | 21-05-2019 | 0.38 | 2 | 355 |
2 | 3647 | THE VILLAGE OF HARLEM....NEW YORK ! | 4632 | Elisabeth | Manhattan | Harlem | 40.80902 | -73.94190 | Private room | 150 | 3 | 0 | NaN | NaN | 1 | 365 |
3 | 3831 | Cozy Entire Floor of Brownstone | 4869 | LisaRoxanne | Brooklyn | Clinton Hill | 40.68514 | -73.95976 | Entire home/apt | 89 | 1 | 270 | 05-07-2019 | 4.64 | 1 | 194 |
4 | 5022 | Entire Apt: Spacious Studio/Loft by central park | 7192 | Laura | Manhattan | East Harlem | 40.79851 | -73.94399 | Entire home/apt | 80 | 10 | 9 | 19-11-2018 | 0.10 | 1 | 0 |
Categorical¶
Bar Graph¶
In [20]:
sns.countplot(data=df , x=df["room_type"])
Out[20]:
<Axes: xlabel='room_type', ylabel='count'>
In [5]:
sns.countplot(data=df, x= "neighbourhood_group")
Out[5]:
<Axes: xlabel='neighbourhood_group', ylabel='count'>
In [21]:
sns.countplot(data = df, x ="neighbourhood_group" , hue = "room_type")
Out[21]:
<Axes: xlabel='neighbourhood_group', ylabel='count'>
Pie Chart¶
In [34]:
df["room_type"].value_counts().plot(kind = "pie" , autopct = "%.2f")
Out[34]:
<Axes: ylabel='count'>
In [37]:
df["availability_365"].head(20).value_counts().plot(kind ="bar")
Out[37]:
<Axes: xlabel='availability_365'>
In [9]:
df2 = sns.load_dataset("titanic")
In [10]:
df2.head()
Out[10]:
survived | pclass | sex | age | sibsp | parch | fare | embarked | class | who | adult_male | deck | embark_town | alive | alone | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 0 | 3 | male | 22.0 | 1 | 0 | 7.2500 | S | Third | man | True | NaN | Southampton | no | False |
1 | 1 | 1 | female | 38.0 | 1 | 0 | 71.2833 | C | First | woman | False | C | Cherbourg | yes | False |
2 | 1 | 3 | female | 26.0 | 0 | 0 | 7.9250 | S | Third | woman | False | NaN | Southampton | yes | True |
3 | 1 | 1 | female | 35.0 | 1 | 0 | 53.1000 | S | First | woman | False | C | Southampton | yes | False |
4 | 0 | 3 | male | 35.0 | 0 | 0 | 8.0500 | S | Third | man | True | NaN | Southampton | no | True |
In [11]:
sns.countplot(x = df2["survived"])
Out[11]:
<Axes: xlabel='survived', ylabel='count'>
In [35]:
sns.countplot(x = df2["embark_town"] , hue= df2["survived"])
Out[35]:
<Axes: xlabel='embark_town', ylabel='count'>
In [13]:
df2["class"].value_counts().plot(kind = "pie", autopct = "%.2f")
Out[13]:
<Axes: ylabel='count'>
In [14]:
sns.countplot(x = df2["alone"])
Out[14]:
<Axes: xlabel='alone', ylabel='count'>