如何使用scala来测试Type Map的变量?

时间:2017-09-01 04:01:14

标签: scala

以下代码有警告 value.isInstanceOf[Map[Any,Any]]

non-variable type argument Any in type Map[Any,Any] is unchecked since it is eliminated by erasure

如何在仍然能够检查类型图[任意,任意]的数据时消除警告?

Thx:)

1 个答案:

答案 0 :(得分:2)

这将有效:

from itertools import accumulate
from operator import mul

pd.DataFrame(np.column_stack([
                 list(accumulate(sample[c], mul)) for c in sample.columns]), 
             index=sample.index, 
             columns=sample.columns)

              A    B
2017-08-01    2    3
2017-08-02    8   15
2017-08-03   48  105
2017-08-04  384  945

this question的答案中描述了其他方法。