我有一个数据框(类型为对象,出于预先在某些步骤中插入列表的原因),有三列看起来像这样
FAIL __tests__/FakeUtilsTest.js
● sum › should sum 2 nums
TypeError: (0 , _FakeUtils2.default) is not a function
at Object.<anonymous> (__tests__/FakeUtilsTest.js:6:31)
at tryCallTwo (node_modules/promise/lib/core.js:45:5)
at doResolve (node_modules/promise/lib/core.js:200:13)
at new Promise (node_modules/promise/lib/core.js:66:3)
at Promise.resolve.then.el (node_modules/p-map/index.js:42:16)
at tryCallOne (node_modules/promise/lib/core.js:37:12)
at node_modules/promise/lib/core.js:123:15
● subtract › should subtract 2 nums
TypeError: (0 , _FakeUtils2.default) is not a function
at Object.<anonymous> (__tests__/FakeUtilsTest.js:12:31)
at tryCallTwo (node_modules/promise/lib/core.js:45:5)
at doResolve (node_modules/promise/lib/core.js:200:13)
at new Promise (node_modules/promise/lib/core.js:66:3)
at Promise.resolve.then.el (node_modules/p-map/index.js:42:16)
at tryCallOne (node_modules/promise/lib/core.js:37:12)
at node_modules/promise/lib/core.js:123:15
目前我正在使用seaborn,但是我很难在我的情节中插入正确的传说。
data stimulus trial
0 2 -2 1
1 2 -2 2
2 2 -2 3
3 2 -2 4
4 2 -2 5
5 2 -2 6
6 1 -2 7
...
159 1 2.5 16
所以我有两个问题。如何顺利地将传奇与seaborn融为一体?我将如何使用pandas plot命令获得此图?我以为我需要这样的东西:
# spi_num is my dataframe
sns.swarmplot(x="stimulus", y="data", data=spi_num.astype(np.float), edgecolor="black", linewidth=.9)
sns.boxplot(x="stimulus", y="data", data=spi_num.astype(np.float), saturation=1)
然后我得到10个数字(每个刺激一个),每个x标签有3个箱图,即“数据”,“刺激”和“试验”。这不应该给我一个如上所示的情节吗?至少he does it like this。
spi_num.astype(np.float).groupby('stimulus').plot.box()