Adding row and column total to pivot table fails












0















I want to display row and column total. I am using margin=True but the output does not show row total as below code and output:



import pandas as pd
df2 = pd.read_csv("https://www.dropbox.com/s/90y07129zn351z9/test_data.csv?dl=1",encoding="latin-1")

df2['received'] = pd.to_datetime(df2['received'])
df2['sent'] = pd.to_datetime(df2['sent'])


pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent'])
.pivot_table(index=['site'], values=['received','sent'],
aggfunc='count', margins=True, dropna=False)
pvt_all['to_send']= pvt_all['received']-pvt_all['sent']
pvt_all=pvt_all[['received','sent','to_send']]
pvt_all

received sent to_send
site
2 32.0 27.0 5.0
3 20.0 17.0 3.0
4 33.0 31.0 2.0
5 40.0 31.0 9.0
All 125.0 106.0 19.0


Sample data below to allow easiness for you besides it is a long one. You can also find in url provided in df vector above. The DataFrame consists of four variables: date, site, received and sent.



date    site    received    sent
7/10/2018 2
7/10/2018 2
7/11/2018 2
7/11/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/13/2018 2 7/13/2018 12:50 7/18/2018 14:44
7/13/2018 2
7/18/2018 2
7/19/2018 2
7/19/2018 2
7/23/2018 2
7/23/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/16/2018 2
7/16/2018 2
7/17/2018 2
7/17/2018 2
7/18/2018 2
7/18/2018 2
7/18/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/19/2018 2
7/19/2018 2
7/19/2018 2
7/26/2018 2
7/26/2018 2
7/25/2018 2
7/24/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/24/2018 2
7/23/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/24/2018 2
7/24/2018 2
7/24/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/23/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/24/2018 2
7/9/2018 2
7/10/2018 2
7/9/2018 2 7/9/2018 15:19 7/11/2018 10:25
7/10/2018 2 7/10/2018 12:26 7/11/2018 10:25
7/10/2018 2
7/19/2018 2
7/19/2018 2
7/19/2018 2 7/19/2018 14:22 7/25/2018 10:35
7/23/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/23/2018 2
7/19/2018 2
7/19/2018 5
7/23/2018 2
7/23/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/6/2018 2
7/6/2018 2
7/6/2018 2
7/9/2018 2
7/9/2018 2
7/24/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/2/2018 2
7/2/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
6/29/2018 2
6/29/2018 2
6/29/2018 2
7/2/2018 2
7/2/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/9/2018 2
7/9/2018 2
7/9/2018 2
7/10/2018 2 7/10/2018 12:26 7/11/2018 10:25
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/11/2018 2 7/11/2018 14:54 7/18/2018 14:44
7/11/2018 2
7/13/2018 2
7/12/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/18/2018 2 7/18/2018 14:35 7/25/2018 10:35
7/19/2018 2
7/18/2018 2
7/19/2018 2
7/19/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/18/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2 7/26/2018 15:35
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/23/2018 2
7/24/2018 2
7/24/2018 2
7/24/2018 2 7/24/2018 15:31 7/25/2018 10:35
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2 7/25/2018 15:34
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2
7/26/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2 7/26/2018 15:55
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/27/2018 2
7/24/2018 2
7/24/2018 2
7/24/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
6/29/2018 2
6/29/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
6/29/2018 2
7/6/2018 2
7/6/2018 2
7/6/2018 2
7/9/2018 2
7/2/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2 7/3/2018 15:20 7/4/2018 11:35
7/4/2018 2
7/5/2018 2
7/6/2018 2
7/4/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2
7/5/2018 2 7/5/2018 15:15 7/11/2018 10:25
7/6/2018 2
7/9/2018 2 7/9/2018 15:19 7/11/2018 10:25
7/9/2018 2
7/10/2018 2
7/5/2018 2 7/5/2018 15:15 7/11/2018 10:25
7/6/2018 2
7/6/2018 2 7/6/2018 13:30 7/11/2018 10:25
7/6/2018 2
7/6/2018 2 7/6/2018 13:30 7/11/2018 10:25
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/11/2018 2
7/10/2018 2
7/13/2018 2
7/13/2018 2 7/13/2018 12:50
7/13/2018 2 7/13/2018 12:50 7/18/2018 14:44
7/12/2018 2 7/12/2018 15:30 7/18/2018 14:44
7/11/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/27/2018 2
7/27/2018 2
7/26/2018 2
7/26/2018 2 7/26/2018 15:55
7/26/2018 2
7/26/2018 2
7/27/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/19/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
6/29/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
7/6/2018 2
7/6/2018 2
7/9/2018 2
7/9/2018 2
7/2/2018 2 7/2/2018 15:38 7/4/2018 11:35
7/2/2018 2
7/3/2018 2
7/5/2018 2
7/3/2018 2 7/3/2018 14:15 7/4/2018 11:35
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/11/2018 2
7/11/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/16/2018 2 7/16/2018 14:25 7/4/2018 15:30
7/16/2018 2
7/16/2018 2
7/17/2018 2 7/17/2018 14:50 7/18/2018 14:44
7/17/2018 2
7/17/2018 2
7/18/2018 2
7/17/2018 2
7/18/2018 2
7/18/2018 2 7/18/2018 14:35 7/25/2018 10:35
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
6/20/2018 5
6/20/2018 5
6/22/2018 5
6/19/2018 5 6/19/2018 14:20 6/28/2018 14:20
6/19/2018 5 6/19/2018 14:20 6/28/2018 14:20
6/27/2018 5
6/28/2018 5
6/28/2018 5 6/28/2018 11:30 7/4/2018 15:30
6/28/2018 5
6/28/2018 5
7/24/2018 5
7/24/2018 5
6/28/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
6/19/2018 5
6/20/2018 5 6/19/2018 14:20 6/28/2018 14:20
6/20/2018 5
6/19/2018 5
6/19/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
6/26/2018 5 6/26/2018 11:40 6/28/2018 14:20
6/27/2018 5
6/27/2018 5 6/27/2018 14:36 6/28/2018 14:20
6/27/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5
6/22/2018 5
6/20/2018 5 6/19/2018 12:40 6/28/2018 14:20
6/20/2018 5
6/20/2018 5
6/20/2018 5 6/20/2018 11:10 6/28/2018 14:20
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5 6/21/2018 1:26 6/28/2018 14:20
6/22/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5 6/22/2018 2:30 6/28/2018 14:20
6/26/2018 5
6/26/2018 5
6/26/2018 5 6/20/2018 11:10 6/28/2018 14:20
6/26/2018 5 6/26/2018 2:36 6/28/2018 14:20
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/27/2018 5 6/27/2018 14:36 6/28/2018 14:20
6/27/2018 5
6/27/2018 5
6/28/2018 5
6/28/2018 5
6/28/2018 5
6/28/2018 5
6/28/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5 6/19/2018 2:20 6/28/2018 14:20
6/20/2018 5 6/20/2018 2:15 6/28/2018 14:20
6/20/2018 5
6/20/2018 5
6/20/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5 7/25/2018 14:45
7/25/2018 5
7/25/2018 5
7/24/2018 5
7/24/2018 5
7/25/2018 5 7/25/2018 14:45
7/25/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5
6/22/2018 5 6/22/2018 12:00 6/28/2018 14:20
6/20/2018 5 6/21/2018 2:35 6/28/2018 14:20
6/20/2018 5
6/20/2018 5
6/20/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/22/2018 5
6/22/2018 5 6/22/2018 14:30 6/28/2018 14:20
6/22/2018 5
6/22/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
7/3/2018 5
7/3/2018 5
7/3/2018 5
7/3/2018 5
7/3/2018 5 7/3/2018 14:45 7/4/2018 15:30
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/24/2018 5
7/24/2018 5
7/25/2018 5
7/24/2018 5
7/24/2018 5
7/24/2018 5
7/25/2018 5
7/24/2018 5 7/25/2018 14:45
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/3/2018 5
7/3/2018 5 7/3/2018 14:45 7/4/2018 15:30
7/3/2018 5
7/23/2018 5
7/3/2018 5
7/3/2018 5 7/3/2018 14:45 7/4/2018 15:30
7/3/2018 5
7/3/2018 5
7/11/2018 5
7/10/2018 5
7/11/2018 5 7/11/2018 12:47 7/13/2018 15:30
7/11/2018 5
7/11/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5 7/24/2018 13:40
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5
7/23/2018 5 7/23/2018 16:20
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/24/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5 7/10/2018 16:10 7/13/2018 15:30
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/16/2018 5
7/10/2018 5 7/10/2018 16:20 7/13/2018 15:30
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/18/2018 5
7/18/2018 5 7/18/2018 12:35 7/21/2018 11:20
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5 7/12/2018 16:38 7/13/2018 15:30
7/12/2018 5
7/12/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/20/2018 5
7/23/2018 5
7/23/2018 5
7/16/2018 5
7/23/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/18/2018 5
7/23/2018 5
7/23/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/24/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/18/2018 5
7/24/2018 5
7/18/2018 5
7/18/2018 5 7/18/2018 13:00 7/21/2018 11:20
7/18/2018 5 7/18/2018 10:30 7/21/2018 11:20
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/16/2018 5
7/16/2018 5
7/19/2018 5
7/20/2018 5
7/20/2018 5 7/20/2018 14:30 7/21/2018 11:20
7/20/2018 5
7/20/2018 5
7/19/2018 5
7/16/2018 5
7/16/2018 5
7/16/2018 5
7/16/2018 5
7/16/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5 7/19/2018 11:50 7/21/2018 11:20
7/19/2018 5
7/19/2018 5
7/23/2018 5
7/23/2018 5 7/23/2018 16:20
7/23/2018 5
7/13/2018 5
7/25/2018 5
7/25/2018 5 7/25/2018 14:45
7/25/2018 5 7/25/2018 14:45
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/23/2018 5 7/23/2018 16:20
7/19/2018 5
7/19/2018 5 7/19/2018 13:30 7/21/2018 11:20
7/19/2018 5
7/19/2018 5
7/20/2018 5
6/26/2018 4
6/26/2018 4
6/27/2018 4
6/27/2018 4
6/27/2018 4
6/26/2018 4
6/27/2018 4
6/27/2018 4
6/27/2018 4
6/27/2018 4
7/3/2018 4
6/28/2018 4
6/28/2018 4
7/3/2018 4
7/4/2018 4
6/28/2018 4
6/29/2018 4
6/28/2018 4
6/28/2018 4
6/29/2018 4
6/28/2018 4
6/28/2018 4 6/28/2018 15:00 7/4/2018 15:45
6/28/2018 4
6/28/2018 4
6/29/2018 4
7/11/2018 4
7/11/2018 4
7/6/2018 4
7/6/2018 4
7/6/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/12/2018 4
7/12/2018 4 7/12/2018 14:09 7/17/2018 15:00
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/13/2018 4
7/13/2018 4
7/13/2018 4
7/13/2018 4 7/13/2018 10:52 7/17/2018 15:00
7/13/2018 4
7/12/2018 4 7/12/2018 16:28 7/17/2018 15:00
7/13/2018 4 7/13/2018 10:52 7/17/2018 15:00
7/13/2018 4
7/13/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/13/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4 7/18/2018 16:21 7/24/2018 14:30
7/19/2018 4
7/16/2018 4
7/13/2018 4
7/13/2018 4
7/13/2018 4
7/16/2018 4
7/17/2018 4
7/13/2018 4
7/16/2018 4
7/16/2018 4
7/13/2018 4 7/13/2018 14:15 7/17/2018 15:00
7/12/2018 4
7/11/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/11/2018 4
7/12/2018 4
7/11/2018 4
7/11/2018 4 7/11/2018 13:40 7/17/2018 15:00
7/12/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/13/2018 4
7/5/2018 4
7/5/2018 4
7/6/2018 4
7/6/2018 4 7/6/2018 13:00 7/10/2018 13:30
7/6/2018 4 7/6/2018 15:30 7/10/2018 13:30
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/4/2018 4
7/4/2018 4
7/4/2018 4 7/4/2018 11:20 7/10/2018 13:30
7/3/2018 4
7/18/2018 4
7/19/2018 4
7/18/2018 4
7/4/2018 4 7/4/2018 11:20 7/10/2018 13:30
7/17/2018 4
7/19/2018 4
7/20/2018 4
7/4/2018 4 7/4/2018 11:20 7/10/2018 13:30
7/4/2018 4 7/4/2018 13:48 7/10/2018 13:30
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4 7/3/2018 14:30 7/4/2018 15:45
7/3/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4
7/6/2018 4
7/6/2018 4
7/5/2018 4
7/5/2018 4 7/5/2018 16:20 7/10/2018 13:30
7/5/2018 4
6/26/2018 4
6/27/2018 4
6/28/2018 4
7/11/2018 4
6/28/2018 4
7/18/2018 4 7/18/2018 10:56 7/24/2018 14:30
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/17/2018 4
7/17/2018 4
7/17/2018 4 7/17/2018 13:20 7/24/2018 14:30
7/17/2018 4
7/17/2018 4 7/17/2018 16:30 7/24/2018 14:30
7/17/2018 4
7/17/2018 4
7/17/2018 4
7/17/2018 4
7/17/2018 4
7/19/2018 4 7/19/2018 12:50 7/24/2018 14:30
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/19/2018 4 7/19/2018 14:04 7/24/2018 14:30
7/19/2018 4
7/19/2018 4
7/20/2018 4
7/20/2018 4
7/19/2018 4 7/19/2018 12:50 7/24/2018 14:30
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4 7/20/2018 12:40 7/24/2018 14:30
7/19/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/24/2018 4
7/24/2018 4
7/24/2018 4
7/25/2018 4
7/24/2018 4
7/25/2018 4
7/25/2018 4
7/25/2018 4
7/25/2018 4 7/25/2018 13:00
7/20/2018 4
7/20/2018 4
7/20/2018 4 7/20/2018 13:55 7/24/2018 14:30
7/23/2018 4 7/23/2018 12:48 7/24/2018 14:30
7/23/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/23/2018 4
7/24/2018 4
7/20/2018 4
7/20/2018 4 7/20/2018 12:40 7/24/2018 14:30
7/20/2018 4
7/23/2018 4
7/25/2018 4
7/26/2018 4
7/25/2018 4
7/26/2018 4
7/25/2018 4
7/26/2018 4
7/27/2018 4
7/26/2018 4
7/27/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4 7/26/2018 14:02
7/27/2018 4
7/26/2018 4
7/27/2018 4
7/26/2018 4
7/27/2018 4
7/27/2018 4
7/27/2018 4
7/27/2018 4
7/27/2018 4
7/25/2018 4
7/25/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
6/19/2018 3 6/18/2018 15:00 6/28/2018 11:35
6/19/2018 3
6/19/2018 3
6/20/2018 3
6/20/2018 3
6/20/2018 3
6/20/2018 3
6/20/2018 3
6/21/2018 3
6/21/2018 3
6/21/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/26/2018 3 6/26/2018 12:35 6/28/2018 11:35
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/20/2018 3
6/21/2018 3
6/21/2018 3
6/21/2018 3
6/20/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
6/21/2018 3
6/21/2018 3
6/21/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/26/2018 3
6/26/2018 3
6/22/2018 3
6/22/2018 3 6/22/2018 14:10 6/28/2018 11:35
6/22/2018 3
6/26/2018 3
6/26/2018 3 6/26/2018 12:35 6/28/2018 11:35
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/27/2018 3 6/27/2018 13:20 6/28/2018 11:35
6/27/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/19/2018 3
6/19/2018 3
6/19/2018 3
6/20/2018 3
6/20/2018 3
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/27/2018 3 6/27/2018 13:20 6/28/2018 11:35
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/28/2018 3 6/28/2018 12:15 7/4/2018 10:50
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3 6/28/2018 15:22 7/4/2018 10:50
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/26/2018 3 6/26/2018 13:35 6/28/2018 11:35
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/27/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/27/2018 3
6/27/2018 3
6/28/2018 3 6/28/2018 12:15 7/4/2018 10:50
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/29/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3 7/4/2018 13:20 7/10/2018 11:15
7/4/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/9/2018 3
7/9/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/10/2018 3
7/10/2018 3
7/10/2018 3
7/11/2018 3
7/11/2018 3
7/5/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/10/2018 3
7/10/2018 3
7/10/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/12/2018 3
7/12/2018 3
7/12/2018 3
7/12/2018 3
7/12/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/20/2018 3
7/20/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/18/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/23/2018 3
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3
7/18/2018 3 7/18/2018 14:30 7/24/2018 13:00
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/24/2018 3 7/24/2018 14:00
7/24/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/24/2018 3
7/24/2018 3 7/24/2018 14:00
7/24/2018 3
7/24/2018 3
7/25/2018 3 7/25/2018 15:00
7/25/2018 3
7/25/2018 3
7/25/2018 3
7/25/2018 3
7/26/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/25/2018 3
7/25/2018 3
7/26/2018 3
7/23/2018 3
7/26/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/25/2018 3
7/26/2018 3
7/26/2018 3
7/26/2018 3
7/27/2018 3
7/27/2018 3









share|improve this question

























  • would you be able to post the sample data? and you may want to look at this post

    – MattR
    Jan 10 at 21:03











  • @MattR, sample data are already in the code here: df2 = pd.read_csv("dropbox.com/s/90y07129zn351z9/…)

    – MGB.py
    Jan 10 at 21:05











  • @MattR, I already had read that podt you shared and thought not applicable to my case.Thanks

    – MGB.py
    Jan 10 at 21:08






  • 1





    the reason why you will want to add sample data instead of dropbox is two fold. Some people do not want to go to external sites to help answer your question. Also, if that link breaks in the future, those who come to this post won't be able to follow along. I suggest you add the sample data and read this post on creating good pandas examples. The easier you make it for those to help you, the more help you may receive :)

    – MattR
    Jan 10 at 21:23











  • @MattR, thanks for your explanation and clarification. Now, I understand the reasons. Please, check again, I have updated my question.

    – MGB.py
    Jan 10 at 22:28
















0















I want to display row and column total. I am using margin=True but the output does not show row total as below code and output:



import pandas as pd
df2 = pd.read_csv("https://www.dropbox.com/s/90y07129zn351z9/test_data.csv?dl=1",encoding="latin-1")

df2['received'] = pd.to_datetime(df2['received'])
df2['sent'] = pd.to_datetime(df2['sent'])


pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent'])
.pivot_table(index=['site'], values=['received','sent'],
aggfunc='count', margins=True, dropna=False)
pvt_all['to_send']= pvt_all['received']-pvt_all['sent']
pvt_all=pvt_all[['received','sent','to_send']]
pvt_all

received sent to_send
site
2 32.0 27.0 5.0
3 20.0 17.0 3.0
4 33.0 31.0 2.0
5 40.0 31.0 9.0
All 125.0 106.0 19.0


Sample data below to allow easiness for you besides it is a long one. You can also find in url provided in df vector above. The DataFrame consists of four variables: date, site, received and sent.



date    site    received    sent
7/10/2018 2
7/10/2018 2
7/11/2018 2
7/11/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/13/2018 2 7/13/2018 12:50 7/18/2018 14:44
7/13/2018 2
7/18/2018 2
7/19/2018 2
7/19/2018 2
7/23/2018 2
7/23/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/16/2018 2
7/16/2018 2
7/17/2018 2
7/17/2018 2
7/18/2018 2
7/18/2018 2
7/18/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/19/2018 2
7/19/2018 2
7/19/2018 2
7/26/2018 2
7/26/2018 2
7/25/2018 2
7/24/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/24/2018 2
7/23/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/24/2018 2
7/24/2018 2
7/24/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/23/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/24/2018 2
7/9/2018 2
7/10/2018 2
7/9/2018 2 7/9/2018 15:19 7/11/2018 10:25
7/10/2018 2 7/10/2018 12:26 7/11/2018 10:25
7/10/2018 2
7/19/2018 2
7/19/2018 2
7/19/2018 2 7/19/2018 14:22 7/25/2018 10:35
7/23/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/23/2018 2
7/19/2018 2
7/19/2018 5
7/23/2018 2
7/23/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/6/2018 2
7/6/2018 2
7/6/2018 2
7/9/2018 2
7/9/2018 2
7/24/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/2/2018 2
7/2/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
6/29/2018 2
6/29/2018 2
6/29/2018 2
7/2/2018 2
7/2/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/9/2018 2
7/9/2018 2
7/9/2018 2
7/10/2018 2 7/10/2018 12:26 7/11/2018 10:25
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/11/2018 2 7/11/2018 14:54 7/18/2018 14:44
7/11/2018 2
7/13/2018 2
7/12/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/18/2018 2 7/18/2018 14:35 7/25/2018 10:35
7/19/2018 2
7/18/2018 2
7/19/2018 2
7/19/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/18/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2 7/26/2018 15:35
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/23/2018 2
7/24/2018 2
7/24/2018 2
7/24/2018 2 7/24/2018 15:31 7/25/2018 10:35
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2 7/25/2018 15:34
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2
7/26/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2 7/26/2018 15:55
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/27/2018 2
7/24/2018 2
7/24/2018 2
7/24/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
6/29/2018 2
6/29/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
6/29/2018 2
7/6/2018 2
7/6/2018 2
7/6/2018 2
7/9/2018 2
7/2/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2 7/3/2018 15:20 7/4/2018 11:35
7/4/2018 2
7/5/2018 2
7/6/2018 2
7/4/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2
7/5/2018 2 7/5/2018 15:15 7/11/2018 10:25
7/6/2018 2
7/9/2018 2 7/9/2018 15:19 7/11/2018 10:25
7/9/2018 2
7/10/2018 2
7/5/2018 2 7/5/2018 15:15 7/11/2018 10:25
7/6/2018 2
7/6/2018 2 7/6/2018 13:30 7/11/2018 10:25
7/6/2018 2
7/6/2018 2 7/6/2018 13:30 7/11/2018 10:25
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/11/2018 2
7/10/2018 2
7/13/2018 2
7/13/2018 2 7/13/2018 12:50
7/13/2018 2 7/13/2018 12:50 7/18/2018 14:44
7/12/2018 2 7/12/2018 15:30 7/18/2018 14:44
7/11/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/27/2018 2
7/27/2018 2
7/26/2018 2
7/26/2018 2 7/26/2018 15:55
7/26/2018 2
7/26/2018 2
7/27/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/19/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
6/29/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
7/6/2018 2
7/6/2018 2
7/9/2018 2
7/9/2018 2
7/2/2018 2 7/2/2018 15:38 7/4/2018 11:35
7/2/2018 2
7/3/2018 2
7/5/2018 2
7/3/2018 2 7/3/2018 14:15 7/4/2018 11:35
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/11/2018 2
7/11/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/16/2018 2 7/16/2018 14:25 7/4/2018 15:30
7/16/2018 2
7/16/2018 2
7/17/2018 2 7/17/2018 14:50 7/18/2018 14:44
7/17/2018 2
7/17/2018 2
7/18/2018 2
7/17/2018 2
7/18/2018 2
7/18/2018 2 7/18/2018 14:35 7/25/2018 10:35
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
6/20/2018 5
6/20/2018 5
6/22/2018 5
6/19/2018 5 6/19/2018 14:20 6/28/2018 14:20
6/19/2018 5 6/19/2018 14:20 6/28/2018 14:20
6/27/2018 5
6/28/2018 5
6/28/2018 5 6/28/2018 11:30 7/4/2018 15:30
6/28/2018 5
6/28/2018 5
7/24/2018 5
7/24/2018 5
6/28/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
6/19/2018 5
6/20/2018 5 6/19/2018 14:20 6/28/2018 14:20
6/20/2018 5
6/19/2018 5
6/19/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
6/26/2018 5 6/26/2018 11:40 6/28/2018 14:20
6/27/2018 5
6/27/2018 5 6/27/2018 14:36 6/28/2018 14:20
6/27/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5
6/22/2018 5
6/20/2018 5 6/19/2018 12:40 6/28/2018 14:20
6/20/2018 5
6/20/2018 5
6/20/2018 5 6/20/2018 11:10 6/28/2018 14:20
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5 6/21/2018 1:26 6/28/2018 14:20
6/22/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5 6/22/2018 2:30 6/28/2018 14:20
6/26/2018 5
6/26/2018 5
6/26/2018 5 6/20/2018 11:10 6/28/2018 14:20
6/26/2018 5 6/26/2018 2:36 6/28/2018 14:20
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/27/2018 5 6/27/2018 14:36 6/28/2018 14:20
6/27/2018 5
6/27/2018 5
6/28/2018 5
6/28/2018 5
6/28/2018 5
6/28/2018 5
6/28/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5 6/19/2018 2:20 6/28/2018 14:20
6/20/2018 5 6/20/2018 2:15 6/28/2018 14:20
6/20/2018 5
6/20/2018 5
6/20/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5 7/25/2018 14:45
7/25/2018 5
7/25/2018 5
7/24/2018 5
7/24/2018 5
7/25/2018 5 7/25/2018 14:45
7/25/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5
6/22/2018 5 6/22/2018 12:00 6/28/2018 14:20
6/20/2018 5 6/21/2018 2:35 6/28/2018 14:20
6/20/2018 5
6/20/2018 5
6/20/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/22/2018 5
6/22/2018 5 6/22/2018 14:30 6/28/2018 14:20
6/22/2018 5
6/22/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
7/3/2018 5
7/3/2018 5
7/3/2018 5
7/3/2018 5
7/3/2018 5 7/3/2018 14:45 7/4/2018 15:30
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/24/2018 5
7/24/2018 5
7/25/2018 5
7/24/2018 5
7/24/2018 5
7/24/2018 5
7/25/2018 5
7/24/2018 5 7/25/2018 14:45
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/3/2018 5
7/3/2018 5 7/3/2018 14:45 7/4/2018 15:30
7/3/2018 5
7/23/2018 5
7/3/2018 5
7/3/2018 5 7/3/2018 14:45 7/4/2018 15:30
7/3/2018 5
7/3/2018 5
7/11/2018 5
7/10/2018 5
7/11/2018 5 7/11/2018 12:47 7/13/2018 15:30
7/11/2018 5
7/11/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5 7/24/2018 13:40
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5
7/23/2018 5 7/23/2018 16:20
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/24/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5 7/10/2018 16:10 7/13/2018 15:30
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/16/2018 5
7/10/2018 5 7/10/2018 16:20 7/13/2018 15:30
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/18/2018 5
7/18/2018 5 7/18/2018 12:35 7/21/2018 11:20
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5 7/12/2018 16:38 7/13/2018 15:30
7/12/2018 5
7/12/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/20/2018 5
7/23/2018 5
7/23/2018 5
7/16/2018 5
7/23/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/18/2018 5
7/23/2018 5
7/23/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/24/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/18/2018 5
7/24/2018 5
7/18/2018 5
7/18/2018 5 7/18/2018 13:00 7/21/2018 11:20
7/18/2018 5 7/18/2018 10:30 7/21/2018 11:20
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/16/2018 5
7/16/2018 5
7/19/2018 5
7/20/2018 5
7/20/2018 5 7/20/2018 14:30 7/21/2018 11:20
7/20/2018 5
7/20/2018 5
7/19/2018 5
7/16/2018 5
7/16/2018 5
7/16/2018 5
7/16/2018 5
7/16/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5 7/19/2018 11:50 7/21/2018 11:20
7/19/2018 5
7/19/2018 5
7/23/2018 5
7/23/2018 5 7/23/2018 16:20
7/23/2018 5
7/13/2018 5
7/25/2018 5
7/25/2018 5 7/25/2018 14:45
7/25/2018 5 7/25/2018 14:45
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/23/2018 5 7/23/2018 16:20
7/19/2018 5
7/19/2018 5 7/19/2018 13:30 7/21/2018 11:20
7/19/2018 5
7/19/2018 5
7/20/2018 5
6/26/2018 4
6/26/2018 4
6/27/2018 4
6/27/2018 4
6/27/2018 4
6/26/2018 4
6/27/2018 4
6/27/2018 4
6/27/2018 4
6/27/2018 4
7/3/2018 4
6/28/2018 4
6/28/2018 4
7/3/2018 4
7/4/2018 4
6/28/2018 4
6/29/2018 4
6/28/2018 4
6/28/2018 4
6/29/2018 4
6/28/2018 4
6/28/2018 4 6/28/2018 15:00 7/4/2018 15:45
6/28/2018 4
6/28/2018 4
6/29/2018 4
7/11/2018 4
7/11/2018 4
7/6/2018 4
7/6/2018 4
7/6/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/12/2018 4
7/12/2018 4 7/12/2018 14:09 7/17/2018 15:00
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/13/2018 4
7/13/2018 4
7/13/2018 4
7/13/2018 4 7/13/2018 10:52 7/17/2018 15:00
7/13/2018 4
7/12/2018 4 7/12/2018 16:28 7/17/2018 15:00
7/13/2018 4 7/13/2018 10:52 7/17/2018 15:00
7/13/2018 4
7/13/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/13/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4 7/18/2018 16:21 7/24/2018 14:30
7/19/2018 4
7/16/2018 4
7/13/2018 4
7/13/2018 4
7/13/2018 4
7/16/2018 4
7/17/2018 4
7/13/2018 4
7/16/2018 4
7/16/2018 4
7/13/2018 4 7/13/2018 14:15 7/17/2018 15:00
7/12/2018 4
7/11/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/11/2018 4
7/12/2018 4
7/11/2018 4
7/11/2018 4 7/11/2018 13:40 7/17/2018 15:00
7/12/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/13/2018 4
7/5/2018 4
7/5/2018 4
7/6/2018 4
7/6/2018 4 7/6/2018 13:00 7/10/2018 13:30
7/6/2018 4 7/6/2018 15:30 7/10/2018 13:30
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/4/2018 4
7/4/2018 4
7/4/2018 4 7/4/2018 11:20 7/10/2018 13:30
7/3/2018 4
7/18/2018 4
7/19/2018 4
7/18/2018 4
7/4/2018 4 7/4/2018 11:20 7/10/2018 13:30
7/17/2018 4
7/19/2018 4
7/20/2018 4
7/4/2018 4 7/4/2018 11:20 7/10/2018 13:30
7/4/2018 4 7/4/2018 13:48 7/10/2018 13:30
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4 7/3/2018 14:30 7/4/2018 15:45
7/3/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4
7/6/2018 4
7/6/2018 4
7/5/2018 4
7/5/2018 4 7/5/2018 16:20 7/10/2018 13:30
7/5/2018 4
6/26/2018 4
6/27/2018 4
6/28/2018 4
7/11/2018 4
6/28/2018 4
7/18/2018 4 7/18/2018 10:56 7/24/2018 14:30
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/17/2018 4
7/17/2018 4
7/17/2018 4 7/17/2018 13:20 7/24/2018 14:30
7/17/2018 4
7/17/2018 4 7/17/2018 16:30 7/24/2018 14:30
7/17/2018 4
7/17/2018 4
7/17/2018 4
7/17/2018 4
7/17/2018 4
7/19/2018 4 7/19/2018 12:50 7/24/2018 14:30
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/19/2018 4 7/19/2018 14:04 7/24/2018 14:30
7/19/2018 4
7/19/2018 4
7/20/2018 4
7/20/2018 4
7/19/2018 4 7/19/2018 12:50 7/24/2018 14:30
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4 7/20/2018 12:40 7/24/2018 14:30
7/19/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/24/2018 4
7/24/2018 4
7/24/2018 4
7/25/2018 4
7/24/2018 4
7/25/2018 4
7/25/2018 4
7/25/2018 4
7/25/2018 4 7/25/2018 13:00
7/20/2018 4
7/20/2018 4
7/20/2018 4 7/20/2018 13:55 7/24/2018 14:30
7/23/2018 4 7/23/2018 12:48 7/24/2018 14:30
7/23/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/23/2018 4
7/24/2018 4
7/20/2018 4
7/20/2018 4 7/20/2018 12:40 7/24/2018 14:30
7/20/2018 4
7/23/2018 4
7/25/2018 4
7/26/2018 4
7/25/2018 4
7/26/2018 4
7/25/2018 4
7/26/2018 4
7/27/2018 4
7/26/2018 4
7/27/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4 7/26/2018 14:02
7/27/2018 4
7/26/2018 4
7/27/2018 4
7/26/2018 4
7/27/2018 4
7/27/2018 4
7/27/2018 4
7/27/2018 4
7/27/2018 4
7/25/2018 4
7/25/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
6/19/2018 3 6/18/2018 15:00 6/28/2018 11:35
6/19/2018 3
6/19/2018 3
6/20/2018 3
6/20/2018 3
6/20/2018 3
6/20/2018 3
6/20/2018 3
6/21/2018 3
6/21/2018 3
6/21/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/26/2018 3 6/26/2018 12:35 6/28/2018 11:35
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/20/2018 3
6/21/2018 3
6/21/2018 3
6/21/2018 3
6/20/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
6/21/2018 3
6/21/2018 3
6/21/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/26/2018 3
6/26/2018 3
6/22/2018 3
6/22/2018 3 6/22/2018 14:10 6/28/2018 11:35
6/22/2018 3
6/26/2018 3
6/26/2018 3 6/26/2018 12:35 6/28/2018 11:35
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/27/2018 3 6/27/2018 13:20 6/28/2018 11:35
6/27/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/19/2018 3
6/19/2018 3
6/19/2018 3
6/20/2018 3
6/20/2018 3
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/27/2018 3 6/27/2018 13:20 6/28/2018 11:35
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/28/2018 3 6/28/2018 12:15 7/4/2018 10:50
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3 6/28/2018 15:22 7/4/2018 10:50
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/26/2018 3 6/26/2018 13:35 6/28/2018 11:35
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/27/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/27/2018 3
6/27/2018 3
6/28/2018 3 6/28/2018 12:15 7/4/2018 10:50
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/29/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3 7/4/2018 13:20 7/10/2018 11:15
7/4/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/9/2018 3
7/9/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/10/2018 3
7/10/2018 3
7/10/2018 3
7/11/2018 3
7/11/2018 3
7/5/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/10/2018 3
7/10/2018 3
7/10/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/12/2018 3
7/12/2018 3
7/12/2018 3
7/12/2018 3
7/12/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/20/2018 3
7/20/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/18/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/23/2018 3
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3
7/18/2018 3 7/18/2018 14:30 7/24/2018 13:00
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/24/2018 3 7/24/2018 14:00
7/24/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/24/2018 3
7/24/2018 3 7/24/2018 14:00
7/24/2018 3
7/24/2018 3
7/25/2018 3 7/25/2018 15:00
7/25/2018 3
7/25/2018 3
7/25/2018 3
7/25/2018 3
7/26/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/25/2018 3
7/25/2018 3
7/26/2018 3
7/23/2018 3
7/26/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/25/2018 3
7/26/2018 3
7/26/2018 3
7/26/2018 3
7/27/2018 3
7/27/2018 3









share|improve this question

























  • would you be able to post the sample data? and you may want to look at this post

    – MattR
    Jan 10 at 21:03











  • @MattR, sample data are already in the code here: df2 = pd.read_csv("dropbox.com/s/90y07129zn351z9/…)

    – MGB.py
    Jan 10 at 21:05











  • @MattR, I already had read that podt you shared and thought not applicable to my case.Thanks

    – MGB.py
    Jan 10 at 21:08






  • 1





    the reason why you will want to add sample data instead of dropbox is two fold. Some people do not want to go to external sites to help answer your question. Also, if that link breaks in the future, those who come to this post won't be able to follow along. I suggest you add the sample data and read this post on creating good pandas examples. The easier you make it for those to help you, the more help you may receive :)

    – MattR
    Jan 10 at 21:23











  • @MattR, thanks for your explanation and clarification. Now, I understand the reasons. Please, check again, I have updated my question.

    – MGB.py
    Jan 10 at 22:28














0












0








0








I want to display row and column total. I am using margin=True but the output does not show row total as below code and output:



import pandas as pd
df2 = pd.read_csv("https://www.dropbox.com/s/90y07129zn351z9/test_data.csv?dl=1",encoding="latin-1")

df2['received'] = pd.to_datetime(df2['received'])
df2['sent'] = pd.to_datetime(df2['sent'])


pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent'])
.pivot_table(index=['site'], values=['received','sent'],
aggfunc='count', margins=True, dropna=False)
pvt_all['to_send']= pvt_all['received']-pvt_all['sent']
pvt_all=pvt_all[['received','sent','to_send']]
pvt_all

received sent to_send
site
2 32.0 27.0 5.0
3 20.0 17.0 3.0
4 33.0 31.0 2.0
5 40.0 31.0 9.0
All 125.0 106.0 19.0


Sample data below to allow easiness for you besides it is a long one. You can also find in url provided in df vector above. The DataFrame consists of four variables: date, site, received and sent.



date    site    received    sent
7/10/2018 2
7/10/2018 2
7/11/2018 2
7/11/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/13/2018 2 7/13/2018 12:50 7/18/2018 14:44
7/13/2018 2
7/18/2018 2
7/19/2018 2
7/19/2018 2
7/23/2018 2
7/23/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/16/2018 2
7/16/2018 2
7/17/2018 2
7/17/2018 2
7/18/2018 2
7/18/2018 2
7/18/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/19/2018 2
7/19/2018 2
7/19/2018 2
7/26/2018 2
7/26/2018 2
7/25/2018 2
7/24/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/24/2018 2
7/23/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/24/2018 2
7/24/2018 2
7/24/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/23/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/24/2018 2
7/9/2018 2
7/10/2018 2
7/9/2018 2 7/9/2018 15:19 7/11/2018 10:25
7/10/2018 2 7/10/2018 12:26 7/11/2018 10:25
7/10/2018 2
7/19/2018 2
7/19/2018 2
7/19/2018 2 7/19/2018 14:22 7/25/2018 10:35
7/23/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/23/2018 2
7/19/2018 2
7/19/2018 5
7/23/2018 2
7/23/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/6/2018 2
7/6/2018 2
7/6/2018 2
7/9/2018 2
7/9/2018 2
7/24/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/2/2018 2
7/2/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
6/29/2018 2
6/29/2018 2
6/29/2018 2
7/2/2018 2
7/2/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/9/2018 2
7/9/2018 2
7/9/2018 2
7/10/2018 2 7/10/2018 12:26 7/11/2018 10:25
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/11/2018 2 7/11/2018 14:54 7/18/2018 14:44
7/11/2018 2
7/13/2018 2
7/12/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/18/2018 2 7/18/2018 14:35 7/25/2018 10:35
7/19/2018 2
7/18/2018 2
7/19/2018 2
7/19/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/18/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2 7/26/2018 15:35
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/23/2018 2
7/24/2018 2
7/24/2018 2
7/24/2018 2 7/24/2018 15:31 7/25/2018 10:35
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2 7/25/2018 15:34
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2
7/26/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2 7/26/2018 15:55
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/27/2018 2
7/24/2018 2
7/24/2018 2
7/24/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
6/29/2018 2
6/29/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
6/29/2018 2
7/6/2018 2
7/6/2018 2
7/6/2018 2
7/9/2018 2
7/2/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2 7/3/2018 15:20 7/4/2018 11:35
7/4/2018 2
7/5/2018 2
7/6/2018 2
7/4/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2
7/5/2018 2 7/5/2018 15:15 7/11/2018 10:25
7/6/2018 2
7/9/2018 2 7/9/2018 15:19 7/11/2018 10:25
7/9/2018 2
7/10/2018 2
7/5/2018 2 7/5/2018 15:15 7/11/2018 10:25
7/6/2018 2
7/6/2018 2 7/6/2018 13:30 7/11/2018 10:25
7/6/2018 2
7/6/2018 2 7/6/2018 13:30 7/11/2018 10:25
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/11/2018 2
7/10/2018 2
7/13/2018 2
7/13/2018 2 7/13/2018 12:50
7/13/2018 2 7/13/2018 12:50 7/18/2018 14:44
7/12/2018 2 7/12/2018 15:30 7/18/2018 14:44
7/11/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/27/2018 2
7/27/2018 2
7/26/2018 2
7/26/2018 2 7/26/2018 15:55
7/26/2018 2
7/26/2018 2
7/27/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/19/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
6/29/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
7/6/2018 2
7/6/2018 2
7/9/2018 2
7/9/2018 2
7/2/2018 2 7/2/2018 15:38 7/4/2018 11:35
7/2/2018 2
7/3/2018 2
7/5/2018 2
7/3/2018 2 7/3/2018 14:15 7/4/2018 11:35
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/11/2018 2
7/11/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/16/2018 2 7/16/2018 14:25 7/4/2018 15:30
7/16/2018 2
7/16/2018 2
7/17/2018 2 7/17/2018 14:50 7/18/2018 14:44
7/17/2018 2
7/17/2018 2
7/18/2018 2
7/17/2018 2
7/18/2018 2
7/18/2018 2 7/18/2018 14:35 7/25/2018 10:35
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
6/20/2018 5
6/20/2018 5
6/22/2018 5
6/19/2018 5 6/19/2018 14:20 6/28/2018 14:20
6/19/2018 5 6/19/2018 14:20 6/28/2018 14:20
6/27/2018 5
6/28/2018 5
6/28/2018 5 6/28/2018 11:30 7/4/2018 15:30
6/28/2018 5
6/28/2018 5
7/24/2018 5
7/24/2018 5
6/28/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
6/19/2018 5
6/20/2018 5 6/19/2018 14:20 6/28/2018 14:20
6/20/2018 5
6/19/2018 5
6/19/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
6/26/2018 5 6/26/2018 11:40 6/28/2018 14:20
6/27/2018 5
6/27/2018 5 6/27/2018 14:36 6/28/2018 14:20
6/27/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5
6/22/2018 5
6/20/2018 5 6/19/2018 12:40 6/28/2018 14:20
6/20/2018 5
6/20/2018 5
6/20/2018 5 6/20/2018 11:10 6/28/2018 14:20
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5 6/21/2018 1:26 6/28/2018 14:20
6/22/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5 6/22/2018 2:30 6/28/2018 14:20
6/26/2018 5
6/26/2018 5
6/26/2018 5 6/20/2018 11:10 6/28/2018 14:20
6/26/2018 5 6/26/2018 2:36 6/28/2018 14:20
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/27/2018 5 6/27/2018 14:36 6/28/2018 14:20
6/27/2018 5
6/27/2018 5
6/28/2018 5
6/28/2018 5
6/28/2018 5
6/28/2018 5
6/28/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5 6/19/2018 2:20 6/28/2018 14:20
6/20/2018 5 6/20/2018 2:15 6/28/2018 14:20
6/20/2018 5
6/20/2018 5
6/20/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5 7/25/2018 14:45
7/25/2018 5
7/25/2018 5
7/24/2018 5
7/24/2018 5
7/25/2018 5 7/25/2018 14:45
7/25/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5
6/22/2018 5 6/22/2018 12:00 6/28/2018 14:20
6/20/2018 5 6/21/2018 2:35 6/28/2018 14:20
6/20/2018 5
6/20/2018 5
6/20/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/22/2018 5
6/22/2018 5 6/22/2018 14:30 6/28/2018 14:20
6/22/2018 5
6/22/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
7/3/2018 5
7/3/2018 5
7/3/2018 5
7/3/2018 5
7/3/2018 5 7/3/2018 14:45 7/4/2018 15:30
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/24/2018 5
7/24/2018 5
7/25/2018 5
7/24/2018 5
7/24/2018 5
7/24/2018 5
7/25/2018 5
7/24/2018 5 7/25/2018 14:45
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/3/2018 5
7/3/2018 5 7/3/2018 14:45 7/4/2018 15:30
7/3/2018 5
7/23/2018 5
7/3/2018 5
7/3/2018 5 7/3/2018 14:45 7/4/2018 15:30
7/3/2018 5
7/3/2018 5
7/11/2018 5
7/10/2018 5
7/11/2018 5 7/11/2018 12:47 7/13/2018 15:30
7/11/2018 5
7/11/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5 7/24/2018 13:40
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5
7/23/2018 5 7/23/2018 16:20
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/24/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5 7/10/2018 16:10 7/13/2018 15:30
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/16/2018 5
7/10/2018 5 7/10/2018 16:20 7/13/2018 15:30
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/18/2018 5
7/18/2018 5 7/18/2018 12:35 7/21/2018 11:20
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5 7/12/2018 16:38 7/13/2018 15:30
7/12/2018 5
7/12/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/20/2018 5
7/23/2018 5
7/23/2018 5
7/16/2018 5
7/23/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/18/2018 5
7/23/2018 5
7/23/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/24/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/18/2018 5
7/24/2018 5
7/18/2018 5
7/18/2018 5 7/18/2018 13:00 7/21/2018 11:20
7/18/2018 5 7/18/2018 10:30 7/21/2018 11:20
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/16/2018 5
7/16/2018 5
7/19/2018 5
7/20/2018 5
7/20/2018 5 7/20/2018 14:30 7/21/2018 11:20
7/20/2018 5
7/20/2018 5
7/19/2018 5
7/16/2018 5
7/16/2018 5
7/16/2018 5
7/16/2018 5
7/16/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5 7/19/2018 11:50 7/21/2018 11:20
7/19/2018 5
7/19/2018 5
7/23/2018 5
7/23/2018 5 7/23/2018 16:20
7/23/2018 5
7/13/2018 5
7/25/2018 5
7/25/2018 5 7/25/2018 14:45
7/25/2018 5 7/25/2018 14:45
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/23/2018 5 7/23/2018 16:20
7/19/2018 5
7/19/2018 5 7/19/2018 13:30 7/21/2018 11:20
7/19/2018 5
7/19/2018 5
7/20/2018 5
6/26/2018 4
6/26/2018 4
6/27/2018 4
6/27/2018 4
6/27/2018 4
6/26/2018 4
6/27/2018 4
6/27/2018 4
6/27/2018 4
6/27/2018 4
7/3/2018 4
6/28/2018 4
6/28/2018 4
7/3/2018 4
7/4/2018 4
6/28/2018 4
6/29/2018 4
6/28/2018 4
6/28/2018 4
6/29/2018 4
6/28/2018 4
6/28/2018 4 6/28/2018 15:00 7/4/2018 15:45
6/28/2018 4
6/28/2018 4
6/29/2018 4
7/11/2018 4
7/11/2018 4
7/6/2018 4
7/6/2018 4
7/6/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/12/2018 4
7/12/2018 4 7/12/2018 14:09 7/17/2018 15:00
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/13/2018 4
7/13/2018 4
7/13/2018 4
7/13/2018 4 7/13/2018 10:52 7/17/2018 15:00
7/13/2018 4
7/12/2018 4 7/12/2018 16:28 7/17/2018 15:00
7/13/2018 4 7/13/2018 10:52 7/17/2018 15:00
7/13/2018 4
7/13/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/13/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4 7/18/2018 16:21 7/24/2018 14:30
7/19/2018 4
7/16/2018 4
7/13/2018 4
7/13/2018 4
7/13/2018 4
7/16/2018 4
7/17/2018 4
7/13/2018 4
7/16/2018 4
7/16/2018 4
7/13/2018 4 7/13/2018 14:15 7/17/2018 15:00
7/12/2018 4
7/11/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/11/2018 4
7/12/2018 4
7/11/2018 4
7/11/2018 4 7/11/2018 13:40 7/17/2018 15:00
7/12/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/13/2018 4
7/5/2018 4
7/5/2018 4
7/6/2018 4
7/6/2018 4 7/6/2018 13:00 7/10/2018 13:30
7/6/2018 4 7/6/2018 15:30 7/10/2018 13:30
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/4/2018 4
7/4/2018 4
7/4/2018 4 7/4/2018 11:20 7/10/2018 13:30
7/3/2018 4
7/18/2018 4
7/19/2018 4
7/18/2018 4
7/4/2018 4 7/4/2018 11:20 7/10/2018 13:30
7/17/2018 4
7/19/2018 4
7/20/2018 4
7/4/2018 4 7/4/2018 11:20 7/10/2018 13:30
7/4/2018 4 7/4/2018 13:48 7/10/2018 13:30
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4 7/3/2018 14:30 7/4/2018 15:45
7/3/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4
7/6/2018 4
7/6/2018 4
7/5/2018 4
7/5/2018 4 7/5/2018 16:20 7/10/2018 13:30
7/5/2018 4
6/26/2018 4
6/27/2018 4
6/28/2018 4
7/11/2018 4
6/28/2018 4
7/18/2018 4 7/18/2018 10:56 7/24/2018 14:30
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/17/2018 4
7/17/2018 4
7/17/2018 4 7/17/2018 13:20 7/24/2018 14:30
7/17/2018 4
7/17/2018 4 7/17/2018 16:30 7/24/2018 14:30
7/17/2018 4
7/17/2018 4
7/17/2018 4
7/17/2018 4
7/17/2018 4
7/19/2018 4 7/19/2018 12:50 7/24/2018 14:30
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/19/2018 4 7/19/2018 14:04 7/24/2018 14:30
7/19/2018 4
7/19/2018 4
7/20/2018 4
7/20/2018 4
7/19/2018 4 7/19/2018 12:50 7/24/2018 14:30
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4 7/20/2018 12:40 7/24/2018 14:30
7/19/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/24/2018 4
7/24/2018 4
7/24/2018 4
7/25/2018 4
7/24/2018 4
7/25/2018 4
7/25/2018 4
7/25/2018 4
7/25/2018 4 7/25/2018 13:00
7/20/2018 4
7/20/2018 4
7/20/2018 4 7/20/2018 13:55 7/24/2018 14:30
7/23/2018 4 7/23/2018 12:48 7/24/2018 14:30
7/23/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/23/2018 4
7/24/2018 4
7/20/2018 4
7/20/2018 4 7/20/2018 12:40 7/24/2018 14:30
7/20/2018 4
7/23/2018 4
7/25/2018 4
7/26/2018 4
7/25/2018 4
7/26/2018 4
7/25/2018 4
7/26/2018 4
7/27/2018 4
7/26/2018 4
7/27/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4 7/26/2018 14:02
7/27/2018 4
7/26/2018 4
7/27/2018 4
7/26/2018 4
7/27/2018 4
7/27/2018 4
7/27/2018 4
7/27/2018 4
7/27/2018 4
7/25/2018 4
7/25/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
6/19/2018 3 6/18/2018 15:00 6/28/2018 11:35
6/19/2018 3
6/19/2018 3
6/20/2018 3
6/20/2018 3
6/20/2018 3
6/20/2018 3
6/20/2018 3
6/21/2018 3
6/21/2018 3
6/21/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/26/2018 3 6/26/2018 12:35 6/28/2018 11:35
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/20/2018 3
6/21/2018 3
6/21/2018 3
6/21/2018 3
6/20/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
6/21/2018 3
6/21/2018 3
6/21/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/26/2018 3
6/26/2018 3
6/22/2018 3
6/22/2018 3 6/22/2018 14:10 6/28/2018 11:35
6/22/2018 3
6/26/2018 3
6/26/2018 3 6/26/2018 12:35 6/28/2018 11:35
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/27/2018 3 6/27/2018 13:20 6/28/2018 11:35
6/27/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/19/2018 3
6/19/2018 3
6/19/2018 3
6/20/2018 3
6/20/2018 3
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/27/2018 3 6/27/2018 13:20 6/28/2018 11:35
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/28/2018 3 6/28/2018 12:15 7/4/2018 10:50
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3 6/28/2018 15:22 7/4/2018 10:50
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/26/2018 3 6/26/2018 13:35 6/28/2018 11:35
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/27/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/27/2018 3
6/27/2018 3
6/28/2018 3 6/28/2018 12:15 7/4/2018 10:50
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/29/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3 7/4/2018 13:20 7/10/2018 11:15
7/4/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/9/2018 3
7/9/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/10/2018 3
7/10/2018 3
7/10/2018 3
7/11/2018 3
7/11/2018 3
7/5/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/10/2018 3
7/10/2018 3
7/10/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/12/2018 3
7/12/2018 3
7/12/2018 3
7/12/2018 3
7/12/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/20/2018 3
7/20/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/18/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/23/2018 3
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3
7/18/2018 3 7/18/2018 14:30 7/24/2018 13:00
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/24/2018 3 7/24/2018 14:00
7/24/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/24/2018 3
7/24/2018 3 7/24/2018 14:00
7/24/2018 3
7/24/2018 3
7/25/2018 3 7/25/2018 15:00
7/25/2018 3
7/25/2018 3
7/25/2018 3
7/25/2018 3
7/26/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/25/2018 3
7/25/2018 3
7/26/2018 3
7/23/2018 3
7/26/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/25/2018 3
7/26/2018 3
7/26/2018 3
7/26/2018 3
7/27/2018 3
7/27/2018 3









share|improve this question
















I want to display row and column total. I am using margin=True but the output does not show row total as below code and output:



import pandas as pd
df2 = pd.read_csv("https://www.dropbox.com/s/90y07129zn351z9/test_data.csv?dl=1",encoding="latin-1")

df2['received'] = pd.to_datetime(df2['received'])
df2['sent'] = pd.to_datetime(df2['sent'])


pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent'])
.pivot_table(index=['site'], values=['received','sent'],
aggfunc='count', margins=True, dropna=False)
pvt_all['to_send']= pvt_all['received']-pvt_all['sent']
pvt_all=pvt_all[['received','sent','to_send']]
pvt_all

received sent to_send
site
2 32.0 27.0 5.0
3 20.0 17.0 3.0
4 33.0 31.0 2.0
5 40.0 31.0 9.0
All 125.0 106.0 19.0


Sample data below to allow easiness for you besides it is a long one. You can also find in url provided in df vector above. The DataFrame consists of four variables: date, site, received and sent.



date    site    received    sent
7/10/2018 2
7/10/2018 2
7/11/2018 2
7/11/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/13/2018 2 7/13/2018 12:50 7/18/2018 14:44
7/13/2018 2
7/18/2018 2
7/19/2018 2
7/19/2018 2
7/23/2018 2
7/23/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/16/2018 2
7/16/2018 2
7/17/2018 2
7/17/2018 2
7/18/2018 2
7/18/2018 2
7/18/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/19/2018 2
7/19/2018 2
7/19/2018 2
7/26/2018 2
7/26/2018 2
7/25/2018 2
7/24/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/24/2018 2
7/23/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/24/2018 2
7/24/2018 2
7/24/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/23/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/24/2018 2
7/9/2018 2
7/10/2018 2
7/9/2018 2 7/9/2018 15:19 7/11/2018 10:25
7/10/2018 2 7/10/2018 12:26 7/11/2018 10:25
7/10/2018 2
7/19/2018 2
7/19/2018 2
7/19/2018 2 7/19/2018 14:22 7/25/2018 10:35
7/23/2018 2
7/23/2018 2 7/23/2018 15:53 7/25/2018 10:35
7/23/2018 2
7/19/2018 2
7/19/2018 5
7/23/2018 2
7/23/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/6/2018 2
7/6/2018 2
7/6/2018 2
7/9/2018 2
7/9/2018 2
7/24/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/2/2018 2
7/2/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
6/29/2018 2
6/29/2018 2
6/29/2018 2
7/2/2018 2
7/2/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/9/2018 2
7/9/2018 2
7/9/2018 2
7/10/2018 2 7/10/2018 12:26 7/11/2018 10:25
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/11/2018 2 7/11/2018 14:54 7/18/2018 14:44
7/11/2018 2
7/13/2018 2
7/12/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/18/2018 2 7/18/2018 14:35 7/25/2018 10:35
7/19/2018 2
7/18/2018 2
7/19/2018 2
7/19/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/18/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2 7/26/2018 15:35
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/23/2018 2
7/24/2018 2
7/24/2018 2
7/24/2018 2 7/24/2018 15:31 7/25/2018 10:35
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2 7/25/2018 15:34
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2
7/26/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2 7/26/2018 15:55
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/27/2018 2
7/24/2018 2
7/24/2018 2
7/24/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
6/29/2018 2
6/29/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
6/29/2018 2
7/6/2018 2
7/6/2018 2
7/6/2018 2
7/9/2018 2
7/2/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2
7/3/2018 2 7/3/2018 15:20 7/4/2018 11:35
7/4/2018 2
7/5/2018 2
7/6/2018 2
7/4/2018 2
7/25/2018 2
7/25/2018 2
7/25/2018 2
7/26/2018 2
7/5/2018 2 7/5/2018 15:15 7/11/2018 10:25
7/6/2018 2
7/9/2018 2 7/9/2018 15:19 7/11/2018 10:25
7/9/2018 2
7/10/2018 2
7/5/2018 2 7/5/2018 15:15 7/11/2018 10:25
7/6/2018 2
7/6/2018 2 7/6/2018 13:30 7/11/2018 10:25
7/6/2018 2
7/6/2018 2 7/6/2018 13:30 7/11/2018 10:25
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/11/2018 2
7/10/2018 2
7/13/2018 2
7/13/2018 2 7/13/2018 12:50
7/13/2018 2 7/13/2018 12:50 7/18/2018 14:44
7/12/2018 2 7/12/2018 15:30 7/18/2018 14:44
7/11/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/27/2018 2
7/27/2018 2
7/26/2018 2
7/26/2018 2 7/26/2018 15:55
7/26/2018 2
7/26/2018 2
7/27/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/16/2018 2
7/19/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/17/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
7/26/2018 2
6/29/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
7/2/2018 2
7/6/2018 2
7/6/2018 2
7/9/2018 2
7/9/2018 2
7/2/2018 2 7/2/2018 15:38 7/4/2018 11:35
7/2/2018 2
7/3/2018 2
7/5/2018 2
7/3/2018 2 7/3/2018 14:15 7/4/2018 11:35
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/10/2018 2
7/11/2018 2
7/11/2018 2
7/11/2018 2
7/12/2018 2
7/12/2018 2
7/12/2018 2
7/13/2018 2
7/13/2018 2
7/13/2018 2
7/16/2018 2 7/16/2018 14:25 7/4/2018 15:30
7/16/2018 2
7/16/2018 2
7/17/2018 2 7/17/2018 14:50 7/18/2018 14:44
7/17/2018 2
7/17/2018 2
7/18/2018 2
7/17/2018 2
7/18/2018 2
7/18/2018 2 7/18/2018 14:35 7/25/2018 10:35
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
7/27/2018 2
6/20/2018 5
6/20/2018 5
6/22/2018 5
6/19/2018 5 6/19/2018 14:20 6/28/2018 14:20
6/19/2018 5 6/19/2018 14:20 6/28/2018 14:20
6/27/2018 5
6/28/2018 5
6/28/2018 5 6/28/2018 11:30 7/4/2018 15:30
6/28/2018 5
6/28/2018 5
7/24/2018 5
7/24/2018 5
6/28/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
6/19/2018 5
6/20/2018 5 6/19/2018 14:20 6/28/2018 14:20
6/20/2018 5
6/19/2018 5
6/19/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
6/26/2018 5 6/26/2018 11:40 6/28/2018 14:20
6/27/2018 5
6/27/2018 5 6/27/2018 14:36 6/28/2018 14:20
6/27/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5
6/22/2018 5
6/20/2018 5 6/19/2018 12:40 6/28/2018 14:20
6/20/2018 5
6/20/2018 5
6/20/2018 5 6/20/2018 11:10 6/28/2018 14:20
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5 6/21/2018 1:26 6/28/2018 14:20
6/22/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5 6/22/2018 2:30 6/28/2018 14:20
6/26/2018 5
6/26/2018 5
6/26/2018 5 6/20/2018 11:10 6/28/2018 14:20
6/26/2018 5 6/26/2018 2:36 6/28/2018 14:20
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/27/2018 5 6/27/2018 14:36 6/28/2018 14:20
6/27/2018 5
6/27/2018 5
6/28/2018 5
6/28/2018 5
6/28/2018 5
6/28/2018 5
6/28/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5
6/19/2018 5 6/19/2018 2:20 6/28/2018 14:20
6/20/2018 5 6/20/2018 2:15 6/28/2018 14:20
6/20/2018 5
6/20/2018 5
6/20/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5
6/22/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5 7/25/2018 14:45
7/25/2018 5
7/25/2018 5
7/24/2018 5
7/24/2018 5
7/25/2018 5 7/25/2018 14:45
7/25/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5
7/25/2018 5
6/22/2018 5 6/22/2018 12:00 6/28/2018 14:20
6/20/2018 5 6/21/2018 2:35 6/28/2018 14:20
6/20/2018 5
6/20/2018 5
6/20/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/22/2018 5
6/22/2018 5 6/22/2018 14:30 6/28/2018 14:20
6/22/2018 5
6/22/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/26/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
6/21/2018 5
7/3/2018 5
7/3/2018 5
7/3/2018 5
7/3/2018 5
7/3/2018 5 7/3/2018 14:45 7/4/2018 15:30
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/2/2018 5
7/24/2018 5
7/24/2018 5
7/25/2018 5
7/24/2018 5
7/24/2018 5
7/24/2018 5
7/25/2018 5
7/24/2018 5 7/25/2018 14:45
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/3/2018 5
7/3/2018 5 7/3/2018 14:45 7/4/2018 15:30
7/3/2018 5
7/23/2018 5
7/3/2018 5
7/3/2018 5 7/3/2018 14:45 7/4/2018 15:30
7/3/2018 5
7/3/2018 5
7/11/2018 5
7/10/2018 5
7/11/2018 5 7/11/2018 12:47 7/13/2018 15:30
7/11/2018 5
7/11/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5 7/24/2018 13:40
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/24/2018 5
7/23/2018 5 7/23/2018 16:20
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/24/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5 7/10/2018 16:10 7/13/2018 15:30
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/16/2018 5
7/10/2018 5 7/10/2018 16:20 7/13/2018 15:30
7/10/2018 5
7/10/2018 5
7/10/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/18/2018 5
7/18/2018 5 7/18/2018 12:35 7/21/2018 11:20
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/11/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/12/2018 5
7/12/2018 5
7/12/2018 5 7/12/2018 16:38 7/13/2018 15:30
7/12/2018 5
7/12/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/20/2018 5
7/23/2018 5
7/23/2018 5
7/16/2018 5
7/23/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/18/2018 5
7/23/2018 5
7/23/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/23/2018 5
7/24/2018 5
7/24/2018 5
7/24/2018 5
7/20/2018 5
7/20/2018 5
7/20/2018 5
7/18/2018 5
7/24/2018 5
7/18/2018 5
7/18/2018 5 7/18/2018 13:00 7/21/2018 11:20
7/18/2018 5 7/18/2018 10:30 7/21/2018 11:20
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/16/2018 5
7/16/2018 5
7/19/2018 5
7/20/2018 5
7/20/2018 5 7/20/2018 14:30 7/21/2018 11:20
7/20/2018 5
7/20/2018 5
7/19/2018 5
7/16/2018 5
7/16/2018 5
7/16/2018 5
7/16/2018 5
7/16/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5 7/19/2018 11:50 7/21/2018 11:20
7/19/2018 5
7/19/2018 5
7/23/2018 5
7/23/2018 5 7/23/2018 16:20
7/23/2018 5
7/13/2018 5
7/25/2018 5
7/25/2018 5 7/25/2018 14:45
7/25/2018 5 7/25/2018 14:45
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/19/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/13/2018 5
7/18/2018 5
7/18/2018 5
7/18/2018 5
7/23/2018 5 7/23/2018 16:20
7/19/2018 5
7/19/2018 5 7/19/2018 13:30 7/21/2018 11:20
7/19/2018 5
7/19/2018 5
7/20/2018 5
6/26/2018 4
6/26/2018 4
6/27/2018 4
6/27/2018 4
6/27/2018 4
6/26/2018 4
6/27/2018 4
6/27/2018 4
6/27/2018 4
6/27/2018 4
7/3/2018 4
6/28/2018 4
6/28/2018 4
7/3/2018 4
7/4/2018 4
6/28/2018 4
6/29/2018 4
6/28/2018 4
6/28/2018 4
6/29/2018 4
6/28/2018 4
6/28/2018 4 6/28/2018 15:00 7/4/2018 15:45
6/28/2018 4
6/28/2018 4
6/29/2018 4
7/11/2018 4
7/11/2018 4
7/6/2018 4
7/6/2018 4
7/6/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/12/2018 4
7/12/2018 4 7/12/2018 14:09 7/17/2018 15:00
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/13/2018 4
7/13/2018 4
7/13/2018 4
7/13/2018 4 7/13/2018 10:52 7/17/2018 15:00
7/13/2018 4
7/12/2018 4 7/12/2018 16:28 7/17/2018 15:00
7/13/2018 4 7/13/2018 10:52 7/17/2018 15:00
7/13/2018 4
7/13/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/13/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4 7/18/2018 16:21 7/24/2018 14:30
7/19/2018 4
7/16/2018 4
7/13/2018 4
7/13/2018 4
7/13/2018 4
7/16/2018 4
7/17/2018 4
7/13/2018 4
7/16/2018 4
7/16/2018 4
7/13/2018 4 7/13/2018 14:15 7/17/2018 15:00
7/12/2018 4
7/11/2018 4
7/12/2018 4
7/12/2018 4
7/12/2018 4
7/11/2018 4
7/12/2018 4
7/11/2018 4
7/11/2018 4 7/11/2018 13:40 7/17/2018 15:00
7/12/2018 4
7/11/2018 4
7/11/2018 4
7/11/2018 4
7/13/2018 4
7/5/2018 4
7/5/2018 4
7/6/2018 4
7/6/2018 4 7/6/2018 13:00 7/10/2018 13:30
7/6/2018 4 7/6/2018 15:30 7/10/2018 13:30
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/4/2018 4
7/4/2018 4
7/4/2018 4 7/4/2018 11:20 7/10/2018 13:30
7/3/2018 4
7/18/2018 4
7/19/2018 4
7/18/2018 4
7/4/2018 4 7/4/2018 11:20 7/10/2018 13:30
7/17/2018 4
7/19/2018 4
7/20/2018 4
7/4/2018 4 7/4/2018 11:20 7/10/2018 13:30
7/4/2018 4 7/4/2018 13:48 7/10/2018 13:30
7/5/2018 4
7/5/2018 4
7/5/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4 7/3/2018 14:30 7/4/2018 15:45
7/3/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4
7/3/2018 4 7/3/2018 12:50 7/4/2018 15:45
7/3/2018 4
7/6/2018 4
7/6/2018 4
7/5/2018 4
7/5/2018 4 7/5/2018 16:20 7/10/2018 13:30
7/5/2018 4
6/26/2018 4
6/27/2018 4
6/28/2018 4
7/11/2018 4
6/28/2018 4
7/18/2018 4 7/18/2018 10:56 7/24/2018 14:30
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/18/2018 4
7/17/2018 4
7/17/2018 4
7/17/2018 4 7/17/2018 13:20 7/24/2018 14:30
7/17/2018 4
7/17/2018 4 7/17/2018 16:30 7/24/2018 14:30
7/17/2018 4
7/17/2018 4
7/17/2018 4
7/17/2018 4
7/17/2018 4
7/19/2018 4 7/19/2018 12:50 7/24/2018 14:30
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/19/2018 4 7/19/2018 14:04 7/24/2018 14:30
7/19/2018 4
7/19/2018 4
7/20/2018 4
7/20/2018 4
7/19/2018 4 7/19/2018 12:50 7/24/2018 14:30
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/19/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4 7/20/2018 12:40 7/24/2018 14:30
7/19/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/24/2018 4
7/24/2018 4
7/24/2018 4
7/25/2018 4
7/24/2018 4
7/25/2018 4
7/25/2018 4
7/25/2018 4
7/25/2018 4 7/25/2018 13:00
7/20/2018 4
7/20/2018 4
7/20/2018 4 7/20/2018 13:55 7/24/2018 14:30
7/23/2018 4 7/23/2018 12:48 7/24/2018 14:30
7/23/2018 4
7/20/2018 4
7/20/2018 4
7/20/2018 4
7/23/2018 4
7/24/2018 4
7/20/2018 4
7/20/2018 4 7/20/2018 12:40 7/24/2018 14:30
7/20/2018 4
7/23/2018 4
7/25/2018 4
7/26/2018 4
7/25/2018 4
7/26/2018 4
7/25/2018 4
7/26/2018 4
7/27/2018 4
7/26/2018 4
7/27/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4 7/26/2018 14:02
7/27/2018 4
7/26/2018 4
7/27/2018 4
7/26/2018 4
7/27/2018 4
7/27/2018 4
7/27/2018 4
7/27/2018 4
7/27/2018 4
7/25/2018 4
7/25/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
7/26/2018 4
6/19/2018 3 6/18/2018 15:00 6/28/2018 11:35
6/19/2018 3
6/19/2018 3
6/20/2018 3
6/20/2018 3
6/20/2018 3
6/20/2018 3
6/20/2018 3
6/21/2018 3
6/21/2018 3
6/21/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/26/2018 3 6/26/2018 12:35 6/28/2018 11:35
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/20/2018 3
6/21/2018 3
6/21/2018 3
6/21/2018 3
6/20/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
6/21/2018 3
6/21/2018 3
6/21/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/22/2018 3
6/26/2018 3
6/26/2018 3
6/22/2018 3
6/22/2018 3 6/22/2018 14:10 6/28/2018 11:35
6/22/2018 3
6/26/2018 3
6/26/2018 3 6/26/2018 12:35 6/28/2018 11:35
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/27/2018 3 6/27/2018 13:20 6/28/2018 11:35
6/27/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/19/2018 3
6/19/2018 3
6/19/2018 3
6/20/2018 3
6/20/2018 3
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/27/2018 3 6/27/2018 13:20 6/28/2018 11:35
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/27/2018 3
6/28/2018 3 6/28/2018 12:15 7/4/2018 10:50
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3 6/28/2018 15:22 7/4/2018 10:50
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/26/2018 3 6/26/2018 13:35 6/28/2018 11:35
6/26/2018 3
6/26/2018 3
6/26/2018 3
6/27/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/27/2018 3
6/27/2018 3
6/28/2018 3 6/28/2018 12:15 7/4/2018 10:50
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/28/2018 3
6/29/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
6/29/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/2/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/3/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3
7/4/2018 3 7/4/2018 13:20 7/10/2018 11:15
7/4/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/9/2018 3
7/9/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/5/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/10/2018 3
7/10/2018 3
7/10/2018 3
7/11/2018 3
7/11/2018 3
7/5/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/9/2018 3
7/9/2018 3
7/9/2018 3
7/10/2018 3
7/10/2018 3
7/10/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/11/2018 3
7/12/2018 3
7/12/2018 3
7/12/2018 3
7/12/2018 3
7/12/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/20/2018 3
7/20/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/13/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/18/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/17/2018 3
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/23/2018 3
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3
7/18/2018 3 7/18/2018 14:30 7/24/2018 13:00
7/18/2018 3
7/18/2018 3
7/18/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/20/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/24/2018 3 7/24/2018 14:00
7/24/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3 7/23/2018 15:10 7/24/2018 13:00
7/23/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/24/2018 3
7/24/2018 3 7/24/2018 14:00
7/24/2018 3
7/24/2018 3
7/25/2018 3 7/25/2018 15:00
7/25/2018 3
7/25/2018 3
7/25/2018 3
7/25/2018 3
7/26/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/24/2018 3
7/25/2018 3
7/25/2018 3
7/25/2018 3
7/26/2018 3
7/23/2018 3
7/26/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/23/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/27/2018 3
7/25/2018 3
7/26/2018 3
7/26/2018 3
7/26/2018 3
7/27/2018 3
7/27/2018 3






python pandas rowsum column-sum






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 10 at 22:27







MGB.py

















asked Jan 10 at 20:42









MGB.pyMGB.py

6510




6510













  • would you be able to post the sample data? and you may want to look at this post

    – MattR
    Jan 10 at 21:03











  • @MattR, sample data are already in the code here: df2 = pd.read_csv("dropbox.com/s/90y07129zn351z9/…)

    – MGB.py
    Jan 10 at 21:05











  • @MattR, I already had read that podt you shared and thought not applicable to my case.Thanks

    – MGB.py
    Jan 10 at 21:08






  • 1





    the reason why you will want to add sample data instead of dropbox is two fold. Some people do not want to go to external sites to help answer your question. Also, if that link breaks in the future, those who come to this post won't be able to follow along. I suggest you add the sample data and read this post on creating good pandas examples. The easier you make it for those to help you, the more help you may receive :)

    – MattR
    Jan 10 at 21:23











  • @MattR, thanks for your explanation and clarification. Now, I understand the reasons. Please, check again, I have updated my question.

    – MGB.py
    Jan 10 at 22:28



















  • would you be able to post the sample data? and you may want to look at this post

    – MattR
    Jan 10 at 21:03











  • @MattR, sample data are already in the code here: df2 = pd.read_csv("dropbox.com/s/90y07129zn351z9/…)

    – MGB.py
    Jan 10 at 21:05











  • @MattR, I already had read that podt you shared and thought not applicable to my case.Thanks

    – MGB.py
    Jan 10 at 21:08






  • 1





    the reason why you will want to add sample data instead of dropbox is two fold. Some people do not want to go to external sites to help answer your question. Also, if that link breaks in the future, those who come to this post won't be able to follow along. I suggest you add the sample data and read this post on creating good pandas examples. The easier you make it for those to help you, the more help you may receive :)

    – MattR
    Jan 10 at 21:23











  • @MattR, thanks for your explanation and clarification. Now, I understand the reasons. Please, check again, I have updated my question.

    – MGB.py
    Jan 10 at 22:28

















would you be able to post the sample data? and you may want to look at this post

– MattR
Jan 10 at 21:03





would you be able to post the sample data? and you may want to look at this post

– MattR
Jan 10 at 21:03













@MattR, sample data are already in the code here: df2 = pd.read_csv("dropbox.com/s/90y07129zn351z9/…)

– MGB.py
Jan 10 at 21:05





@MattR, sample data are already in the code here: df2 = pd.read_csv("dropbox.com/s/90y07129zn351z9/…)

– MGB.py
Jan 10 at 21:05













@MattR, I already had read that podt you shared and thought not applicable to my case.Thanks

– MGB.py
Jan 10 at 21:08





@MattR, I already had read that podt you shared and thought not applicable to my case.Thanks

– MGB.py
Jan 10 at 21:08




1




1





the reason why you will want to add sample data instead of dropbox is two fold. Some people do not want to go to external sites to help answer your question. Also, if that link breaks in the future, those who come to this post won't be able to follow along. I suggest you add the sample data and read this post on creating good pandas examples. The easier you make it for those to help you, the more help you may receive :)

– MattR
Jan 10 at 21:23





the reason why you will want to add sample data instead of dropbox is two fold. Some people do not want to go to external sites to help answer your question. Also, if that link breaks in the future, those who come to this post won't be able to follow along. I suggest you add the sample data and read this post on creating good pandas examples. The easier you make it for those to help you, the more help you may receive :)

– MattR
Jan 10 at 21:23













@MattR, thanks for your explanation and clarification. Now, I understand the reasons. Please, check again, I have updated my question.

– MGB.py
Jan 10 at 22:28





@MattR, thanks for your explanation and clarification. Now, I understand the reasons. Please, check again, I have updated my question.

– MGB.py
Jan 10 at 22:28












2 Answers
2






active

oldest

votes


















1














Try this, using eval:



df2.dropna(axis=0, how='all', subset=['received', 'sent'])
.pivot_table(index='site', values=['received','sent'],
aggfunc='count', margins=True, dropna=False).eval('Total = received + sent')


Output:



      received  sent  Total
site
2 32 27 59
3 20 17 37
4 33 31 64
5 40 31 71
All 125 106 231





share|improve this answer
























  • Thanks but doesnt work for me. 8 pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent']) .pivot_table(index='site', values=['received','sent'], aggfunc='count', margins=True, dropna=False).eval('Total = received + sent') ----> 9 pvt_all['to_send']= pvt_all['received']-pvt_all['sent'] 10 pvt_all=pvt_all[['received','sent','to_send']] 11 pvt_all TypeError: 'NoneType' object is not subscriptable

    – MGB.py
    Jan 10 at 23:07



















0














df2 = pd.read_csv("https://www.dropbox.com/s/90y07129zn351z9/test_data.csv?dl=1",encoding="latin-1")

df2['received'] = pd.to_datetime(df2['received'])
df2['sent'] = pd.to_datetime(df2['sent'])

import pandas as pd
pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent'])
.pivot_table(index=['site'], values=['received','sent'],
aggfunc='count', margins=True, dropna=False)
pvt_all['to_send']= pvt_all['received']-pvt_all['sent']
#pvt_all['Total'] = pvt_all.received + pvt_all.sent + pvt_all.to_send
pvt_all['Total'] = pvt_all.sum(axis=1) #Add Total column for row subtotal
#and Total
pvt_all=pvt_all[['received','sent','to_send','Total']]
pvt_all


received sent to_send Total
site
2 32.0 27.0 5.0 64.0
3 20.0 17.0 3.0 40.0
4 33.0 31.0 2.0 66.0
5 40.0 31.0 9.0 80.0
All 125.0 106.0 19.0 250.0





share|improve this answer























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54136614%2fadding-row-and-column-total-to-pivot-table-fails%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Try this, using eval:



    df2.dropna(axis=0, how='all', subset=['received', 'sent'])
    .pivot_table(index='site', values=['received','sent'],
    aggfunc='count', margins=True, dropna=False).eval('Total = received + sent')


    Output:



          received  sent  Total
    site
    2 32 27 59
    3 20 17 37
    4 33 31 64
    5 40 31 71
    All 125 106 231





    share|improve this answer
























    • Thanks but doesnt work for me. 8 pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent']) .pivot_table(index='site', values=['received','sent'], aggfunc='count', margins=True, dropna=False).eval('Total = received + sent') ----> 9 pvt_all['to_send']= pvt_all['received']-pvt_all['sent'] 10 pvt_all=pvt_all[['received','sent','to_send']] 11 pvt_all TypeError: 'NoneType' object is not subscriptable

      – MGB.py
      Jan 10 at 23:07
















    1














    Try this, using eval:



    df2.dropna(axis=0, how='all', subset=['received', 'sent'])
    .pivot_table(index='site', values=['received','sent'],
    aggfunc='count', margins=True, dropna=False).eval('Total = received + sent')


    Output:



          received  sent  Total
    site
    2 32 27 59
    3 20 17 37
    4 33 31 64
    5 40 31 71
    All 125 106 231





    share|improve this answer
























    • Thanks but doesnt work for me. 8 pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent']) .pivot_table(index='site', values=['received','sent'], aggfunc='count', margins=True, dropna=False).eval('Total = received + sent') ----> 9 pvt_all['to_send']= pvt_all['received']-pvt_all['sent'] 10 pvt_all=pvt_all[['received','sent','to_send']] 11 pvt_all TypeError: 'NoneType' object is not subscriptable

      – MGB.py
      Jan 10 at 23:07














    1












    1








    1







    Try this, using eval:



    df2.dropna(axis=0, how='all', subset=['received', 'sent'])
    .pivot_table(index='site', values=['received','sent'],
    aggfunc='count', margins=True, dropna=False).eval('Total = received + sent')


    Output:



          received  sent  Total
    site
    2 32 27 59
    3 20 17 37
    4 33 31 64
    5 40 31 71
    All 125 106 231





    share|improve this answer













    Try this, using eval:



    df2.dropna(axis=0, how='all', subset=['received', 'sent'])
    .pivot_table(index='site', values=['received','sent'],
    aggfunc='count', margins=True, dropna=False).eval('Total = received + sent')


    Output:



          received  sent  Total
    site
    2 32 27 59
    3 20 17 37
    4 33 31 64
    5 40 31 71
    All 125 106 231






    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered Jan 10 at 22:40









    Scott BostonScott Boston

    53.5k73055




    53.5k73055













    • Thanks but doesnt work for me. 8 pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent']) .pivot_table(index='site', values=['received','sent'], aggfunc='count', margins=True, dropna=False).eval('Total = received + sent') ----> 9 pvt_all['to_send']= pvt_all['received']-pvt_all['sent'] 10 pvt_all=pvt_all[['received','sent','to_send']] 11 pvt_all TypeError: 'NoneType' object is not subscriptable

      – MGB.py
      Jan 10 at 23:07



















    • Thanks but doesnt work for me. 8 pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent']) .pivot_table(index='site', values=['received','sent'], aggfunc='count', margins=True, dropna=False).eval('Total = received + sent') ----> 9 pvt_all['to_send']= pvt_all['received']-pvt_all['sent'] 10 pvt_all=pvt_all[['received','sent','to_send']] 11 pvt_all TypeError: 'NoneType' object is not subscriptable

      – MGB.py
      Jan 10 at 23:07

















    Thanks but doesnt work for me. 8 pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent']) .pivot_table(index='site', values=['received','sent'], aggfunc='count', margins=True, dropna=False).eval('Total = received + sent') ----> 9 pvt_all['to_send']= pvt_all['received']-pvt_all['sent'] 10 pvt_all=pvt_all[['received','sent','to_send']] 11 pvt_all TypeError: 'NoneType' object is not subscriptable

    – MGB.py
    Jan 10 at 23:07





    Thanks but doesnt work for me. 8 pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent']) .pivot_table(index='site', values=['received','sent'], aggfunc='count', margins=True, dropna=False).eval('Total = received + sent') ----> 9 pvt_all['to_send']= pvt_all['received']-pvt_all['sent'] 10 pvt_all=pvt_all[['received','sent','to_send']] 11 pvt_all TypeError: 'NoneType' object is not subscriptable

    – MGB.py
    Jan 10 at 23:07













    0














    df2 = pd.read_csv("https://www.dropbox.com/s/90y07129zn351z9/test_data.csv?dl=1",encoding="latin-1")

    df2['received'] = pd.to_datetime(df2['received'])
    df2['sent'] = pd.to_datetime(df2['sent'])

    import pandas as pd
    pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent'])
    .pivot_table(index=['site'], values=['received','sent'],
    aggfunc='count', margins=True, dropna=False)
    pvt_all['to_send']= pvt_all['received']-pvt_all['sent']
    #pvt_all['Total'] = pvt_all.received + pvt_all.sent + pvt_all.to_send
    pvt_all['Total'] = pvt_all.sum(axis=1) #Add Total column for row subtotal
    #and Total
    pvt_all=pvt_all[['received','sent','to_send','Total']]
    pvt_all


    received sent to_send Total
    site
    2 32.0 27.0 5.0 64.0
    3 20.0 17.0 3.0 40.0
    4 33.0 31.0 2.0 66.0
    5 40.0 31.0 9.0 80.0
    All 125.0 106.0 19.0 250.0





    share|improve this answer




























      0














      df2 = pd.read_csv("https://www.dropbox.com/s/90y07129zn351z9/test_data.csv?dl=1",encoding="latin-1")

      df2['received'] = pd.to_datetime(df2['received'])
      df2['sent'] = pd.to_datetime(df2['sent'])

      import pandas as pd
      pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent'])
      .pivot_table(index=['site'], values=['received','sent'],
      aggfunc='count', margins=True, dropna=False)
      pvt_all['to_send']= pvt_all['received']-pvt_all['sent']
      #pvt_all['Total'] = pvt_all.received + pvt_all.sent + pvt_all.to_send
      pvt_all['Total'] = pvt_all.sum(axis=1) #Add Total column for row subtotal
      #and Total
      pvt_all=pvt_all[['received','sent','to_send','Total']]
      pvt_all


      received sent to_send Total
      site
      2 32.0 27.0 5.0 64.0
      3 20.0 17.0 3.0 40.0
      4 33.0 31.0 2.0 66.0
      5 40.0 31.0 9.0 80.0
      All 125.0 106.0 19.0 250.0





      share|improve this answer


























        0












        0








        0







        df2 = pd.read_csv("https://www.dropbox.com/s/90y07129zn351z9/test_data.csv?dl=1",encoding="latin-1")

        df2['received'] = pd.to_datetime(df2['received'])
        df2['sent'] = pd.to_datetime(df2['sent'])

        import pandas as pd
        pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent'])
        .pivot_table(index=['site'], values=['received','sent'],
        aggfunc='count', margins=True, dropna=False)
        pvt_all['to_send']= pvt_all['received']-pvt_all['sent']
        #pvt_all['Total'] = pvt_all.received + pvt_all.sent + pvt_all.to_send
        pvt_all['Total'] = pvt_all.sum(axis=1) #Add Total column for row subtotal
        #and Total
        pvt_all=pvt_all[['received','sent','to_send','Total']]
        pvt_all


        received sent to_send Total
        site
        2 32.0 27.0 5.0 64.0
        3 20.0 17.0 3.0 40.0
        4 33.0 31.0 2.0 66.0
        5 40.0 31.0 9.0 80.0
        All 125.0 106.0 19.0 250.0





        share|improve this answer













        df2 = pd.read_csv("https://www.dropbox.com/s/90y07129zn351z9/test_data.csv?dl=1",encoding="latin-1")

        df2['received'] = pd.to_datetime(df2['received'])
        df2['sent'] = pd.to_datetime(df2['sent'])

        import pandas as pd
        pvt_all = df2.dropna(axis=0, how='all', subset=['received', 'sent'])
        .pivot_table(index=['site'], values=['received','sent'],
        aggfunc='count', margins=True, dropna=False)
        pvt_all['to_send']= pvt_all['received']-pvt_all['sent']
        #pvt_all['Total'] = pvt_all.received + pvt_all.sent + pvt_all.to_send
        pvt_all['Total'] = pvt_all.sum(axis=1) #Add Total column for row subtotal
        #and Total
        pvt_all=pvt_all[['received','sent','to_send','Total']]
        pvt_all


        received sent to_send Total
        site
        2 32.0 27.0 5.0 64.0
        3 20.0 17.0 3.0 40.0
        4 33.0 31.0 2.0 66.0
        5 40.0 31.0 9.0 80.0
        All 125.0 106.0 19.0 250.0






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Jan 18 at 23:39









        MGB.pyMGB.py

        6510




        6510






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54136614%2fadding-row-and-column-total-to-pivot-table-fails%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Homophylophilia

            Updating UILabel text programmatically using a function

            Cloud Functions - OpenCV Videocapture Read method fails for larger files from cloud storage