[Django][ Pandas] TypeError: crosstab() missing 1 required positional argument: 'columns'

362 views
Skip to first unread message

Dilipkumar Noone

unread,
Sep 22, 2019, 10:49:36 PM9/22/19
to Django users
Hi,

I am new to django.

MyTask:
======
while handling asynchronous task in Django using celery i need to export some data to excel and need to create a pivotal table from it,

I have a data frame[df] like below:
df :
# read the specific columns from an excel file.
require_cols = ['ID', 'Category', 'PatchLeve1', 'HQ Domain Owners', 'LGSIDomainOwners', 'Ownershipstatus']

# only read the specific columns from an excel file.
df = pd.read_excel(excel_name, use_cols=require_cols)

SerialNo RecordId Category SecurityPatchLevel Applicability Description GSP_ID HQDomainOwners LGSIDomainOwners OwnerShipStatus
1 16 Google Security Patch 2019-02-01 O https://www.collab.com/en/20 CVE_2019_201920 IT1 IT1  
2 17 Google Security Patch 2019-02-01 O https://www.collab.com/en/21 CVE_2019_201921 Connectivity-GPS Connectivity-GPS  
3 18 Google Security Patch 2019-02-01 O https://www.collab.com/en/22 CVE_2019_201922 Media-Framework MM  


===========================================================================================================
while executing below statement, cross tab i am getting TypeError: crosstab() missing 1 required positional argument: 'columns'
===========================================================================================================
gsp_pivoted_table= pd.crosstab([df.Category,df.LGSIDomainOwners],margins=True)
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
print("crosstab for LGSIDomainOwner and ownership status Count")
gsp_pending_notification = pd.crosstab([df.LGSIDomainOwners,df.OwnerShipStatus], margins=True)

return gsp_pivoted_table, gsp_pending_notification;

==========================================================================================================


Please let us know how to proceed further.

Regards,
N.Dilip Kumar.
Reply all
Reply to author
Forward
0 new messages