Facebook
From Denim Duck, 2 Years ago, written in Python.
This paste is a reply to Untitled from Cream Panda - go back
Embed
Viewing differences between Untitled and Re: Untitled
# Import your libraries
import pandas as pd

pd
# Start writing code
airbnb_search_details.groupby(['city', 'property_type'])[['bathrooms', 'bedrooms']].mean().reset_index()result = (pd.pivot_table(airbnb_search_details,
               index=['city', 'property_type'],
               values=['bathrooms', 'bedrooms'])).reset_index()
#reset_index() сбросить заголовки на один уровень, иначе не примает решение