我正在尝试使用ghc-modvim插件进行类型/语法检查等.但是,我发现ghc-mod总是在错误消息中使用完整的类型路径,例如:
test.hs|71 col 13 error| Couldn't match type ‘Data.Text.Internal.Text’
|| with ‘[GHC.Types.Char]’
|| Expected type: containers-0.5.6.2:Data.Map.Base.Map
|| [GHC.Types.Char]
|| ([(integer-gmp-1.0.0.0:GHC.Integer.Type.Integer,
|| integer-gmp-1.0.0.0:GHC.Integer.Type.Integer)],
|| containers-0.5.6.2:Data.Set.Base.Set
|| integer-gmp-1.0.0.0:GHC.Integer.Type.Integer)
|| Actual type: containers-0.5.6.2:Data.Map.Base.Map
|| Data.Text.Internal.Text
|| ([(integer-gmp-1.0.0.0:GHC.Integer.Type.Integer,
|| integer-gmp-1.0.0.0:GHC.Integer.Type.Integer)],
|| containers-0.5.6.2:Data.Set.Base.Set
|| integer-gmp-1.0.0.0:GHC.Integer.Type.Integer)
|| In the second argument of ‘containers-0.5.6.2:Data.Map.Base.map’, namely
|| ‘zippedMap’
|| In the second argument of ‘(GHC.Base.$)’, namely
|| ‘containers-0.5.6.2:Data.Map.Base.map
...
Run Code Online (Sandbox Code Playgroud)
这会使屏幕变得杂乱,我很难找出哪里出了问题.作为比较,这是使用以下内容的同一文件的错误消息ghci:
test.hs:71:13:
Couldn't match type ‘T.Text’ with ‘[Char]’
Expected type: M.Map [Char] ([(Integer, …Run Code Online (Sandbox Code Playgroud) 我有以下DataFrame:
In [1]:
import pandas as pd
df = pd.DataFrame({'a': [1,2,3], 'b': [2,3,4], 'c':['dd','ee','ff'], 'd':[5,9,1]})
df
Out [1]:
a b c d
0 1 2 dd 5
1 2 3 ee 9
2 3 4 ff 1
Run Code Online (Sandbox Code Playgroud)
我想添加一列'e',它是列的总和'a','b'和'd'.
穿过论坛,我觉得这样的东西会起作用:
df['e'] = df[['a','b','d']].map(sum)
Run Code Online (Sandbox Code Playgroud)
但不是!
我想实现具有列列表['a','b','d']和df输入的操作.