First compute the average with the aggregate function avg():
SELECT neighborhood, bedrooms, avg(price)
FROM listings
GROUP BY 1,2
ORDER BY 1,2;
Then feed the result to the crosstab() function as instructed in great detail in this related answer:
- PostgreSQL Crosstab Query