Converting Dask Scalar to integer value (or save it to text file)

后端 未结 1 825
眼角桃花
眼角桃花 2021-01-14 07:15

I have calculated using dask by

from dask import dataframe
all_data = dataframe.read_csv(path) 
total_sum = all_data.account_balance.sum()
         


        
1条回答
  •  时光说笑
    2021-01-14 08:13

    .compute() does indeed bring you a real number, as you can see in this example:

    In [18]: import dask.dataframe as dd
    
    In [19]: d = dd.from_pandas(pd.DataFrame({'a': [3,3,3,3]}), npartitions=2)
    
    In [20]: d.a.sum().compute()
    Out[20]: 12
    

    0 讨论(0)
提交回复
热议问题