Skip to content

#group_by #mode #iter()  #97

@kharade-navin

Description

@kharade-navin

Hi All,

I am summarizing a DF which contains both numeric and categorical variables. Have faced below challenges while using group_by and summarize functions,

  1. While trying to measure the mode for a numerical variables using 'statistics.mode' function in group_by, it shows me below error.
    Code :- Temp2 = Df3 >> group_by(X.ID) >> summarize(AirTemp = statistics.mode(X.Weather_detailsAir_temperature))_
    Error :- TypeError: iter() returned non-iterator of type 'Intention'

  2. Summarizing categorical variable:- With unique in dplyr from R, I am able to summarize categorical variable however its not the same case in dfply - python, even distinct doesn't worked.

Code:-
Test = Df3 >> group_by(X.ID) >> summarize(Precipitation = distinct(X.Precipitation))

Sample data

ID Date_time Weather_detailsAir_temperature Precipitation Precipitation_intensity Relative_humidity Wind_direction Wind_speed_in_m/s Day_time
DR_10002 19-12-2012 09:30 3 clear None 67 180 7 daylight
DR_10002 19-12-2012 09:30 3 clear None 67 180 7 daylight
DR_10002 19-12-2012 09:31 3 clear None 67 180 7 daylight
DR_10002 19-12-2012 09:36 1 clear None 66 163 4 daylight
DR_10002 19-12-2012 09:39 1 clear None 66 163 4 daylight

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions