谢谢您的帮助.
我的数据看起来像这样:
city, room_type
A, X
A, Y
A, Z
B, X
B, Y
B, Y
Run Code Online (Sandbox Code Playgroud)
我希望我的最终结果看起来像这样:
city, count(X), count(Y), count(z)
A, 1, 1, 1
B, 1, 2, 0
Run Code Online (Sandbox Code Playgroud)
我按城市分组,我想显示每个城市中每个room_type的数量.
用python pandas做任何方法吗?谢谢.
我在几年前学过SQL,并认为它可能是可能的.我相信python可以做同样的事情.谢谢!