合并Python中的两个表

时间:2017-03-04 22:37:38

标签: python pandas merge

我已经创建了两个表,我正在尝试合并它们但是由于某种原因它不起作用。

我的两张表是:

table_account_id = data1.groupby('employer_key').account_id.nunique() #how many people logged in (unique account id)

table_eligible = data3.groupby(['employer_key'])[['eligible']].sum().astype('int') #eligible population

我希望我的新表格包含以下列:

Employer_key // account_id // eligible

我认为代码如下,但它不起作用:

new_table = pd.merge(table_eligible, table_account_id, left_index=True, right_index=True)

我能够合并这两个表,直到我将nunique函数插入到table_account_id代码中。

谢谢!

1 个答案:

答案 0 :(得分:0)

我在手机上,你没有发布数据。穿过我的手指,这是有效的。

Layer (type)                     Output Shape          Param #     Connected to                     
====================================================================================================
input_1 (InputLayer)             (None, 3, 225, 225)   0                                            
____________________________________________________________________________________________________
maxpooling2d_1 (MaxPooling2D)    (None, 3, 113, 113)   0           input_1[0][0]                    
____________________________________________________________________________________________________
convolution2d_1 (Convolution2D)  (None, 32, 113, 113)  128         maxpooling2d_1[0][0]             
____________________________________________________________________________________________________
convolution2d_2 (Convolution2D)  (None, 32, 113, 113)  1056        convolution2d_1[0][0]            
____________________________________________________________________________________________________
merge_1 (Merge)                  (None, 64, 113, 113)  0           convolution2d_2[0][0]            
                                                                   convolution2d_1[0][0]            
____________________________________________________________________________________________________
merge_2 (Merge)                  (None, 96, 113, 113)  0           convolution2d_1[0][0]            
                                                                   merge_1[0][0]                    
____________________________________________________________________________________________________
merge_4 (Merge)                  (None, 128, 113, 113) 0           merge_2[0][0]                    
                                                                   convolution2d_2[0][0]            
____________________________________________________________________________________________________
flatten_1 (Flatten)              (None, 1634432)       0           merge_4[0][0]                    
____________________________________________________________________________________________________
activation_1 (Activation)        (None, 1634432)       0           flatten_1[0][0]                  
====================================================================================================