Professional Documents
Culture Documents
Assigment1 - Manuel Tapia
Assigment1 - Manuel Tapia
In [18]: url_adit='https://raw.githubusercontent.com/cinnData/DataSci/main/5.%20Querying
%20data%20in%20Pandas/neighbourhoods.csv';
In [21]: df4.info()
<class 'pandas.core.frame.DataFrame'>
Int64Index: 16794 entries, 0 to 16793
Data columns (total 10 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 host_id 16794 non-null int64
1 host_since 16787 non-null object
2 name 16778 non-null object
3 neighbourhood 16794 non-null object
4 property_type 16794 non-null object
5 room_type 16794 non-null object
6 bedrooms 16794 non-null float64
7 price 16794 non-null int64
8 number_of_reviews 16794 non-null int64
9 review_scores_rating 12908 non-null float64
dtypes: float64(2), int64(3), object(5)
memory usage: 1.4+ MB
In [27]: df4.groupby(['neighbourhood_group','bedrooms'])['price'].median().round()
Out[27]: #Question 5 : We can see that the most expensive neighborhood are Eixample San
marti and gracia, for all type of apartments (1,2 or 3 bedrooms)
In [31]: df4.groupby(['neighbourhood_group','bedrooms'])['price'].median().unstack().round()
#different view of the table, using unstack.
Out[31]:
In [32]: