NYC 311 PROJECT

Discussion in 'Masters Program - Customers only' started by Barath Raj S N, Mar 21, 2020.

  1. Barath Raj S N

    Joined:
    Aug 14, 2019
    Messages:
    3
    Likes Received:
    0
    This question is:
    Order the complaint types based on the average ‘Request_Closing_Time’, grouping them for different locations

    I am trying to do this,
    df=dataframe.groupby(['Location Type','Complaint Type']).agg({'Request_Closing_Time':"mean"}),
    but this is showing me an error of this type," No numeric types to aggregate".
    And if i use this,
    df=dataframe.groupby(['Location Type','Complaint Type'])['Request_Closing_Time'].mean()
    but then to same error
    Can anyone just say how to find average of datetime datatype, I am struggling to get this
     
    #1
  2. Ritwik Bijalwan

    Joined:
    Jul 5, 2019
    Messages:
    3
    Likes Received:
    0

    the syntax can be
    df=dataframe.groupby(['City','Complaint Type']).mean()['Request_Closing_Time']

    Here location is not the attribute Location but the attribute City which represents different location for which service requests have been made
     
    #2
  3. Barath Raj S N

    Joined:
    Aug 14, 2019
    Messages:
    3
    Likes Received:
    0
    Bro Thanks for your reply but i want to order the complaints based on average i obtain for the 'Request_Closing_Time' column,but since it is datetime datatype average of that column is not possible in dataframe, so if u know what can be done can just reply me.
    According to your syntax it is showing an error that "keyworderror: Request_Closing_Time".
     
    #3

Share This Page