在 M1 Mac、macOS Monterey 上运行12.4
,Python 3.10.3
pip install tables
Collecting tables\n Using cached tables-3.7.0.tar.gz (8.2 MB)\n Installing build dependencies ... done\n Getting requirements to build wheel ... error\n error: subprocess-exited-with-error\n \n \xc3\x97 Getting requirements to build wheel did not run successfully.\n \xe2\x94\x82 exit code: 1\n \xe2\x95\xb0\xe2\x94\x80> [12 lines of output]\n /var/folders/6g/9c7g_2tx2sb7lp8ttwtfky640000gn/T/H5closew_79lujq.c:2:5: error: implicit declaration of function \'H5close\' is invalid in C99 [-Werror,-Wimplicit-function-declaration]\n H5close();\n ^\n 1 error generated.\n cpuinfo failed, assuming no CPU features: No module …
Run Code Online (Sandbox Code Playgroud) 我创建了一个pointplot()
,但无法更改 x 轴限制。虽然我的数据只包含 9 个月,但我想在我的轴上显示所有 12 个月。
fig,ax = plt.subplots(figsize=(12,4))
sns.pointplot(data=tr_df, x='Month', y='numOfTrips', hue='Year', ax=ax, palette='nipy_spectral')
# sns.plt.xlim(0, 12) # AttributeError: module 'seaborn' has no attribute 'plt'
# ax.set_xlim=(0, 12) # does nothing
ax.set(xlim=(0, 12))
ax.set(title="Number of trips each month")
Run Code Online (Sandbox Code Playgroud)
我究竟做错了什么?
编辑:用于创建绘图的数据
Year Month numOfTrips
0 2011 7 2608
1 2011 8 33579
2 2011 9 34756
3 2011 10 31423
4 2011 11 20746
5 2012 3 12240
6 2012 4 37637
7 2012 5 46056
8 …
Run Code Online (Sandbox Code Playgroud)