小编use*_*407的帖子

Numpy dtype=int

在下面的代码中。我得到了 x1 的预期结果

import numpy as np 
x1 = np.arange(0.5, 10.4, 0.8)
print(x1)
[ 0.5  1.3  2.1  2.9  3.7  4.5  5.3  6.1  6.9  7.7  8.5  9.3 10.1]
Run Code Online (Sandbox Code Playgroud)

但在下面的代码中,当我设置 dtype=int 时,为什么 x2 的结果不是[ 0 1 2 2 3 4 5 6 6 7 8 9 10],而是我得到 x2 的值,因为[ 0 1 2 3 4 5 6 7 8 9 10 11 12]最后一个值 12 超过了 10.4 的最终值。请澄清我对此的概念。

import numpy as np 
x2 = np.arange(0.5, 10.4, 0.8, dtype=int)
print(x2)
[ …
Run Code Online (Sandbox Code Playgroud)

python numpy numerical-computing python-3.x numpy-ndarray

6
推荐指数
1
解决办法
9059
查看次数

在hive中替换T-SQL isnumeric()

什么是isnumeric()hive 0.10中T-SQL 函数的替代品?

http://technet.microsoft.com/en-us/library/ms186272.aspx
Run Code Online (Sandbox Code Playgroud)

hadoop hive mapreduce

3
推荐指数
1
解决办法
8988
查看次数

在 ExecutorService 中没有得到想要的结果

为什么我在下面的代码中没有将 list1 和 list2 的列表大小设置为 1000:

https://pastebin.com/ttcbkjqR

我的主要方法代码如下:

    ExecutorService executor = Executors.newFixedThreadPool(2);

    for(int j=0; j<2; j++) {
        executor.submit(new Worker(j));
    }

    executor.shutdown();
    System.out.println("All tasks submitted: ");

    try {
        executor.awaitTermination(1, TimeUnit.DAYS);
    } catch (InterruptedException e) {

    }
    long end = System.currentTimeMillis();
    System.out.println("Time taken: " + (end - start));
    System.out.println("List1: " + list1.size() + "; List2: " + list2.size());
Run Code Online (Sandbox Code Playgroud)

在这里Worker上课:

class Worker implements Runnable{
    private int id;
    
    public Worker(int id) {
        this.id = id;
    }

    private Random random = new Random(); …
Run Code Online (Sandbox Code Playgroud)

java multithreading executorservice

0
推荐指数
1
解决办法
57
查看次数