从Dataframe中删除列时出现dask问题(最新的dask 2021.04.1)

tkqqtvp1  于 2021-07-13  发布在  Java
关注(0)|答案(0)|浏览(262)

代码如下:

import pandas as pd
import dask.dataframe as dd
import numpy as np
a = pd.DataFrame({'A':["None",None,None,None,None],'insuredid':[34,90,7779,56,46],'LONGITUDE':[12,34.99,7779.9,56.9,46.90], 'LATITUDE': [12,34.99,np.nan,56.9,46.90]})  
a['EXPTYPE'] = " "
a=dd.from_pandas(a,npartitions=1)
b =pd.DataFrame({'f':[None,None,None,None,None],'insuredid':[34,89,7779,78,46],'test':[12,34.99,7779.9,56.9,46.90]})
b=dd.from_pandas(b,npartitions=1)
a = dd.merge(a,b , how='left' , on ='insuredid').drop(['LATITUDE', 'LONGITUDE'],axis=1)

但这是它显示的错误,而不是期望的输出:

a = dd.merge(a,b , how='left' , on ='insuredid').drop(columns= ['LATITUDE', 'LONGITUDE'],axis=1)

a.head()

获取以下错误

ValueError: Metadata inference failed in `drop_by_shallow_copy`.

You have supplied a custom function and Dask is unable to
determine the type of output that that function returns.

To resolve this please provide a meta= keyword.
The docstring of the Dask function you ran should have more information.

Original error is below:
------------------------
KeyError('[None] not found in axis')

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题