[{"data":1,"prerenderedAt":4846},["ShallowReactive",2],{"tutorials-pandas":3,"category-items-pandas":387,"content-/pandas/groupby-operations":388},[4,21,31,40,49,58,67,78,87,96,105,116,125,134,143,154,163,172,181,192,201,210,219,228,239,248,257,266,276,285,294,303,313,322,331,341,350,359,369,378],{"_path":5,"_dir":6,"_draft":7,"_partial":7,"_locale":6,"title":8,"description":9,"slug":10,"order":11,"isParent":12,"icon":13,"_type":14,"_id":15,"_source":16,"_file":17,"_stem":18,"_extension":19,"children":20,"expanded":12},"/pandas","",false,"Getting Started","Learn the basics of Pandas, Python's powerful data analysis library for working with spreadsheet-like data","getting-started",1,true,"pi pi-play","markdown","content:pandas:1.index.md","content","pandas/1.index.md","pandas/1.index","md",[21,31,40,49,58],{"_path":22,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":24,"description":25,"slug":26,"parentId":5,"order":27,"_type":14,"_id":28,"_source":16,"_file":29,"_stem":30,"_extension":19},"/pandas/what-is-pandas","pandas","What is Pandas","Understand what Pandas is, why it's essential for data analysis, and how it makes working with data simple and powerful","what-is-pandas",2,"content:pandas:2.what-is-pandas.md","pandas/2.what-is-pandas.md","pandas/2.what-is-pandas",{"_path":32,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":33,"description":34,"slug":35,"parentId":5,"order":36,"_type":14,"_id":37,"_source":16,"_file":38,"_stem":39,"_extension":19},"/pandas/installing-pandas","Installing Pandas","Learn how to install Pandas on your computer and verify it's working properly","installing-pandas",3,"content:pandas:3.installing-pandas.md","pandas/3.installing-pandas.md","pandas/3.installing-pandas",{"_path":41,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":42,"description":43,"slug":44,"parentId":5,"order":45,"_type":14,"_id":46,"_source":16,"_file":47,"_stem":48,"_extension":19},"/pandas/your-first-dataframe","Your First DataFrame","Create your first Pandas DataFrame and learn the basics of working with tabular data","your-first-dataframe",4,"content:pandas:4.your-first-dataframe.md","pandas/4.your-first-dataframe.md","pandas/4.your-first-dataframe",{"_path":50,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":51,"description":52,"slug":53,"parentId":5,"order":54,"_type":14,"_id":55,"_source":16,"_file":56,"_stem":57,"_extension":19},"/pandas/series-vs-dataframe","Series vs DataFrame","Understand the difference between Pandas Series and DataFrames, and learn when to use each one","series-vs-dataframe",5,"content:pandas:5.series-vs-dataframe.md","pandas/5.series-vs-dataframe.md","pandas/5.series-vs-dataframe",{"_path":59,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":60,"description":61,"slug":62,"parentId":5,"order":63,"_type":14,"_id":64,"_source":16,"_file":65,"_stem":66,"_extension":19},"/pandas/basic-dataframe-info","Basic DataFrame Info","Learn how to explore and get basic information about your DataFrames to understand your data","basic-dataframe-info",6,"content:pandas:6.basic-dataframe-info.md","pandas/6.basic-dataframe-info.md","pandas/6.basic-dataframe-info",{"_path":68,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":69,"description":70,"slug":71,"order":72,"isParent":12,"icon":73,"_type":14,"_id":74,"_source":16,"_file":75,"_stem":76,"_extension":19,"children":77,"expanded":12},"/pandas/loading-data","Loading Data","Learn how to load data from various sources into Pandas DataFrames","loading-data",7,"pi pi-download","content:pandas:7.loading-data.md","pandas/7.loading-data.md","pandas/7.loading-data",[78,87,96],{"_path":79,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":80,"description":81,"slug":82,"parentId":68,"order":83,"_type":14,"_id":84,"_source":16,"_file":85,"_stem":86,"_extension":19},"/pandas/reading-files","Reading Files (CSV, Excel, JSON)","Learn how to load data from CSV, Excel, and JSON files into Pandas DataFrames","reading-files",8,"content:pandas:8.reading-files.md","pandas/8.reading-files.md","pandas/8.reading-files",{"_path":88,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":89,"description":90,"slug":91,"parentId":68,"order":92,"_type":14,"_id":93,"_source":16,"_file":94,"_stem":95,"_extension":19},"/pandas/loading-from-databases","Loading from Databases","Learn how to connect to databases and load data directly into Pandas DataFrames","loading-from-databases",9,"content:pandas:9.loading-from-databases.md","pandas/9.loading-from-databases.md","pandas/9.loading-from-databases",{"_path":97,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":98,"description":99,"slug":100,"parentId":68,"order":101,"_type":14,"_id":102,"_source":16,"_file":103,"_stem":104,"_extension":19},"/pandas/handling-file-errors","Handling File Errors","Learn how to handle common errors when loading data files and how to troubleshoot loading problems","handling-file-errors",10,"content:pandas:10.handling-file-errors.md","pandas/10.handling-file-errors.md","pandas/10.handling-file-errors",{"_path":106,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":107,"description":108,"slug":109,"order":110,"isParent":12,"icon":111,"_type":14,"_id":112,"_source":16,"_file":113,"_stem":114,"_extension":19,"children":115,"expanded":12},"/pandas/data-exploration","Data Exploration","Learn how to explore and understand your data using Pandas methods and techniques","data-exploration",11,"pi pi-search","content:pandas:11.data-exploration.md","pandas/11.data-exploration.md","pandas/11.data-exploration",[116,125,134],{"_path":117,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":118,"description":119,"slug":120,"parentId":106,"order":121,"_type":14,"_id":122,"_source":16,"_file":123,"_stem":124,"_extension":19},"/pandas/viewing-your-data","Viewing Your Data","Learn different ways to look at and sample your DataFrame data for exploration and understanding","viewing-your-data",12,"content:pandas:12.viewing-your-data.md","pandas/12.viewing-your-data.md","pandas/12.viewing-your-data",{"_path":126,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":127,"description":128,"slug":129,"parentId":106,"order":130,"_type":14,"_id":131,"_source":16,"_file":132,"_stem":133,"_extension":19},"/pandas/data-shape-and-statistics","Data Shape and Statistics","Learn how to understand your DataFrame's size, structure, and get basic statistical summaries","data-shape-and-statistics",13,"content:pandas:13.data-shape-and-statistics.md","pandas/13.data-shape-and-statistics.md","pandas/13.data-shape-and-statistics",{"_path":135,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":136,"description":137,"slug":138,"parentId":106,"order":139,"_type":14,"_id":140,"_source":16,"_file":141,"_stem":142,"_extension":19},"/pandas/column-information-and-data-types","Column Information and Data Types","Learn how to explore individual columns and understand different data types in your DataFrames","column-information-and-data-types",14,"content:pandas:14.column-information-and-data-types.md","pandas/14.column-information-and-data-types.md","pandas/14.column-information-and-data-types",{"_path":144,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":145,"description":146,"slug":147,"order":148,"isParent":12,"icon":149,"_type":14,"_id":150,"_source":16,"_file":151,"_stem":152,"_extension":19,"children":153,"expanded":12},"/pandas/selecting-data","Selecting Data","Learn how to select specific columns, rows, and subsets of data from your DataFrames","selecting-data",15,"pi pi-filter","content:pandas:15.selecting-data.md","pandas/15.selecting-data.md","pandas/15.selecting-data",[154,163,172],{"_path":155,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":156,"description":157,"slug":158,"parentId":144,"order":159,"_type":14,"_id":160,"_source":16,"_file":161,"_stem":162,"_extension":19},"/pandas/selecting-columns-and-rows","Selecting Columns and Rows","Learn how to select specific columns and rows from your DataFrames using basic selection techniques","selecting-columns-and-rows",16,"content:pandas:16.selecting-columns-and-rows.md","pandas/16.selecting-columns-and-rows.md","pandas/16.selecting-columns-and-rows",{"_path":164,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":165,"description":166,"slug":167,"parentId":144,"order":168,"_type":14,"_id":169,"_source":16,"_file":170,"_stem":171,"_extension":19},"/pandas/using-loc-and-iloc","Using loc and iloc","Master precise data selection with label-based (loc) and position-based (iloc) indexing in pandas","using-loc-and-iloc",17,"content:pandas:17.using-loc-and-iloc.md","pandas/17.using-loc-and-iloc.md","pandas/17.using-loc-and-iloc",{"_path":173,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":174,"description":175,"slug":176,"parentId":144,"order":177,"_type":14,"_id":178,"_source":16,"_file":179,"_stem":180,"_extension":19},"/pandas/boolean-and-conditional-selection","Boolean and Conditional Selection","Learn to filter DataFrames using conditions, boolean logic, and multiple criteria for precise data selection","boolean-and-conditional-selection",18,"content:pandas:18.boolean-and-conditional-selection.md","pandas/18.boolean-and-conditional-selection.md","pandas/18.boolean-and-conditional-selection",{"_path":182,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":183,"description":184,"slug":185,"order":186,"isParent":12,"icon":187,"_type":14,"_id":188,"_source":16,"_file":189,"_stem":190,"_extension":19,"children":191,"expanded":12},"/pandas/data-cleaning","Data Cleaning","Learn essential data cleaning techniques to prepare messy data for analysis","data-cleaning",19,"pi pi-wrench","content:pandas:19.data-cleaning.md","pandas/19.data-cleaning.md","pandas/19.data-cleaning",[192,201,210,219],{"_path":193,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":194,"description":195,"slug":196,"parentId":182,"order":197,"_type":14,"_id":198,"_source":16,"_file":199,"_stem":200,"_extension":19},"/pandas/handling-missing-data","Handling Missing Data","Learn to identify, fill, and remove missing values in your DataFrames effectively","handling-missing-data",20,"content:pandas:20.handling-missing-data.md","pandas/20.handling-missing-data.md","pandas/20.handling-missing-data",{"_path":202,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":203,"description":204,"slug":205,"parentId":182,"order":206,"_type":14,"_id":207,"_source":16,"_file":208,"_stem":209,"_extension":19},"/pandas/removing-duplicates","Removing Duplicates","Learn to find and eliminate duplicate rows from your DataFrames to ensure data quality","removing-duplicates",21,"content:pandas:21.removing-duplicates.md","pandas/21.removing-duplicates.md","pandas/21.removing-duplicates",{"_path":211,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":212,"description":213,"slug":214,"parentId":182,"order":215,"_type":14,"_id":216,"_source":16,"_file":217,"_stem":218,"_extension":19},"/pandas/data-type-conversion","Data Type Conversion","Learn to convert data to the right types for proper analysis and calculations","data-type-conversion",22,"content:pandas:22.data-type-conversion.md","pandas/22.data-type-conversion.md","pandas/22.data-type-conversion",{"_path":220,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":221,"description":222,"slug":223,"parentId":182,"order":224,"_type":14,"_id":225,"_source":16,"_file":226,"_stem":227,"_extension":19},"/pandas/string-cleaning-operations","String Cleaning Operations","Learn to clean and standardize text data for consistent analysis using pandas string methods","string-cleaning-operations",23,"content:pandas:23.string-cleaning-operations.md","pandas/23.string-cleaning-operations.md","pandas/23.string-cleaning-operations",{"_path":229,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":230,"description":231,"slug":232,"order":233,"isParent":12,"icon":234,"_type":14,"_id":235,"_source":16,"_file":236,"_stem":237,"_extension":19,"children":238,"expanded":12},"/pandas/data-transformation","Data Transformation","Learn how to modify, add, and transform data in your DataFrames for analysis","data-transformation",24,"pi pi-folder","content:pandas:24.data-transformation.md","pandas/24.data-transformation.md","pandas/24.data-transformation",[239,248,257],{"_path":240,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":241,"description":242,"slug":243,"parentId":229,"order":244,"_type":14,"_id":245,"_source":16,"_file":246,"_stem":247,"_extension":19},"/pandas/adding-and-modifying-columns","Adding and Modifying Columns","Learn how to create new columns and update existing ones with calculations and conditional logic","adding-and-modifying-columns",25,"content:pandas:25.adding-and-modifying-columns.md","pandas/25.adding-and-modifying-columns.md","pandas/25.adding-and-modifying-columns",{"_path":249,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":250,"description":251,"slug":252,"parentId":229,"order":253,"_type":14,"_id":254,"_source":16,"_file":255,"_stem":256,"_extension":19},"/pandas/applying-functions","Applying Functions","Use built-in and custom functions to transform your data efficiently","applying-functions",26,"content:pandas:26.applying-functions.md","pandas/26.applying-functions.md","pandas/26.applying-functions",{"_path":258,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":259,"description":260,"slug":261,"parentId":229,"order":262,"_type":14,"_id":263,"_source":16,"_file":264,"_stem":265,"_extension":19},"/pandas/renaming-and-sorting-data","Renaming and Sorting Data","Organize your DataFrame with better column names and logical data ordering","renaming-and-sorting-data",27,"content:pandas:27.renaming-and-sorting-data.md","pandas/27.renaming-and-sorting-data.md","pandas/27.renaming-and-sorting-data",{"_path":267,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":268,"description":269,"slug":270,"order":271,"isParent":12,"icon":234,"_type":14,"_id":272,"_source":16,"_file":273,"_stem":274,"_extension":19,"children":275,"expanded":12},"/pandas/grouping-and-aggregation","Grouping and Aggregation","Learn to group data and calculate summary statistics for powerful data analysis","grouping-and-aggregation",28,"content:pandas:28.grouping-and-aggregation.md","pandas/28.grouping-and-aggregation.md","pandas/28.grouping-and-aggregation",[276,285,294],{"_path":277,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":278,"description":279,"slug":280,"parentId":267,"order":281,"_type":14,"_id":282,"_source":16,"_file":283,"_stem":284,"_extension":19},"/pandas/groupby-operations","GroupBy Operations","Learn the fundamentals of splitting data into groups and basic aggregations","groupby-operations",29,"content:pandas:29.groupby-operations.md","pandas/29.groupby-operations.md","pandas/29.groupby-operations",{"_path":286,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":287,"description":288,"slug":289,"parentId":267,"order":290,"_type":14,"_id":291,"_source":16,"_file":292,"_stem":293,"_extension":19},"/pandas/aggregation-functions","Aggregation Functions","Explore different ways to summarize your grouped data with built-in and custom functions","aggregation-functions",30,"content:pandas:30.aggregation-functions.md","pandas/30.aggregation-functions.md","pandas/30.aggregation-functions",{"_path":295,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":296,"description":297,"slug":298,"parentId":267,"order":299,"_type":14,"_id":300,"_source":16,"_file":301,"_stem":302,"_extension":19},"/pandas/pivot-tables-and-cross-tabulation","Pivot Tables and Cross Tabulation","Create powerful summary tables and cross-tabulations for analysis","pivot-tables-and-cross-tabulation",31,"content:pandas:31.pivot-tables-and-cross-tabulation.md","pandas/31.pivot-tables-and-cross-tabulation.md","pandas/31.pivot-tables-and-cross-tabulation",{"_path":304,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":305,"description":306,"slug":307,"order":308,"isParent":12,"icon":234,"_type":14,"_id":309,"_source":16,"_file":310,"_stem":311,"_extension":19,"children":312},"/pandas/combining-data","Combining Data","Learn to combine data from multiple DataFrames for comprehensive analysis","combining-data",32,"content:pandas:32.combining-data.md","pandas/32.combining-data.md","pandas/32.combining-data",[313,322],{"_path":314,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":315,"description":316,"slug":317,"parentId":304,"order":318,"_type":14,"_id":319,"_source":16,"_file":320,"_stem":321,"_extension":19},"/pandas/concatenating-dataframes","Concatenating DataFrames","Learn to stack DataFrames vertically and horizontally for simple data combination","concatenating-dataframes",33,"content:pandas:33.concatenating-dataframes.md","pandas/33.concatenating-dataframes.md","pandas/33.concatenating-dataframes",{"_path":323,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":324,"description":325,"slug":326,"parentId":304,"order":327,"_type":14,"_id":328,"_source":16,"_file":329,"_stem":330,"_extension":19},"/pandas/merging-and-join-operations","Merging and Join Operations","Master different types of joins to combine related data from multiple sources","merging-and-join-operations",34,"content:pandas:34.merging-and-join-operations.md","pandas/34.merging-and-join-operations.md","pandas/34.merging-and-join-operations",{"_path":332,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":333,"description":334,"slug":335,"order":336,"isParent":12,"icon":234,"_type":14,"_id":337,"_source":16,"_file":338,"_stem":339,"_extension":19,"children":340},"/pandas/working-with-dates","Working with Dates","Master date and time operations for time-based analysis and reporting","working-with-dates",35,"content:pandas:35.working-with-dates.md","pandas/35.working-with-dates.md","pandas/35.working-with-dates",[341,350],{"_path":342,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":343,"description":344,"slug":345,"parentId":332,"order":346,"_type":14,"_id":347,"_source":16,"_file":348,"_stem":349,"_extension":19},"/pandas/datetime-operations","DateTime Operations","Learn to convert, manipulate, and extract information from dates and times","datetime-operations",36,"content:pandas:36.datetime-operations.md","pandas/36.datetime-operations.md","pandas/36.datetime-operations",{"_path":351,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":352,"description":353,"slug":354,"parentId":332,"order":355,"_type":14,"_id":356,"_source":16,"_file":357,"_stem":358,"_extension":19},"/pandas/time-series-and-resampling","Time Series and Resampling","Discover how to analyze data over time periods and aggregate by different time intervals","time-series-and-resampling",37,"content:pandas:37.time-series-and-resampling.md","pandas/37.time-series-and-resampling.md","pandas/37.time-series-and-resampling",{"_path":360,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":361,"description":362,"slug":363,"order":364,"isParent":12,"icon":234,"_type":14,"_id":365,"_source":16,"_file":366,"_stem":367,"_extension":19,"children":368},"/pandas/saving-your-work","Saving Your Work","Learn to export your analyzed data to different formats for sharing and reporting","saving-your-work",38,"content:pandas:38.saving-your-work.md","pandas/38.saving-your-work.md","pandas/38.saving-your-work",[369,378],{"_path":370,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":371,"description":372,"slug":373,"parentId":360,"order":374,"_type":14,"_id":375,"_source":16,"_file":376,"_stem":377,"_extension":19},"/pandas/exporting-data","Exporting Data (CSV, Excel, JSON)","Learn to save your DataFrames to common file formats for sharing and reporting","exporting-data",39,"content:pandas:39.exporting-data.md","pandas/39.exporting-data.md","pandas/39.exporting-data",{"_path":379,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":380,"description":381,"slug":382,"parentId":360,"order":383,"_type":14,"_id":384,"_source":16,"_file":385,"_stem":386,"_extension":19},"/pandas/database-export","Database Export","Discover how to save data back to databases for integration with other systems","database-export",40,"content:pandas:40.database-export.md","pandas/40.database-export.md","pandas/40.database-export",[276],{"_path":277,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":278,"description":279,"slug":280,"parentId":267,"order":281,"body":389,"_type":14,"_id":282,"_source":16,"_file":283,"_stem":284,"_extension":19},{"type":390,"children":391,"toc":4831},"root",[392,400,406,411,809,816,821,919,925,936,1407,1413,1418,1596,1603,2073,2079,2566,2572,2577,2973,2979,2992,3067,3482,3488,3493,4003,4009,4014,4494,4500,4505,4607,4613,4795,4801,4806,4820,4825],{"type":393,"tag":394,"props":395,"children":396},"element","h1",{"id":280},[397],{"type":398,"value":399},"text","🔗 GroupBy Operations",{"type":393,"tag":401,"props":402,"children":403},"p",{},[404],{"type":398,"value":405},"GroupBy is one of pandas' most powerful features! It lets you split your data into groups based on column values, then apply functions to each group. This is perfect for answering questions like \"What's the average sales by department?\" or \"How many orders per customer?\"",{"type":393,"tag":401,"props":407,"children":408},{},[409],{"type":398,"value":410},"Think of GroupBy like organizing your music collection by artist, then asking questions about each artist's songs.",{"type":393,"tag":412,"props":413,"children":414},"code-try",{},[415],{"type":393,"tag":416,"props":417,"children":421},"pre",{"className":418,"code":419,"language":420,"meta":6,"style":6},"language-python shiki shiki-themes github-light github-dark","import pandas as pd\n\n# Simple sales data\nsales = pd.DataFrame({\n    'department': ['Sales', 'IT', 'Sales', 'HR', 'IT'],\n    'employee': ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve'],\n    'revenue': [50000, 75000, 45000, 30000, 80000]\n})\n\nprint(\"Sales data:\")\nprint(sales)\nprint()\n\n# Group by department and sum revenue\ndept_total = sales.groupby('department')['revenue'].sum()\nprint(\"Total revenue by department:\")\nprint(dept_total)\n","python",[422],{"type":393,"tag":423,"props":424,"children":425},"code",{"__ignoreMap":6},[426,453,461,470,488,547,604,663,671,678,701,713,725,732,740,777,797],{"type":393,"tag":427,"props":428,"children":430},"span",{"class":429,"line":11},"line",[431,437,443,448],{"type":393,"tag":427,"props":432,"children":434},{"style":433},"--shiki-default:#D73A49;--shiki-app-dark-mode:#F97583",[435],{"type":398,"value":436},"import",{"type":393,"tag":427,"props":438,"children":440},{"style":439},"--shiki-default:#24292E;--shiki-app-dark-mode:#E1E4E8",[441],{"type":398,"value":442}," pandas ",{"type":393,"tag":427,"props":444,"children":445},{"style":433},[446],{"type":398,"value":447},"as",{"type":393,"tag":427,"props":449,"children":450},{"style":439},[451],{"type":398,"value":452}," pd\n",{"type":393,"tag":427,"props":454,"children":455},{"class":429,"line":27},[456],{"type":393,"tag":427,"props":457,"children":458},{"emptyLinePlaceholder":12},[459],{"type":398,"value":460},"\n",{"type":393,"tag":427,"props":462,"children":463},{"class":429,"line":36},[464],{"type":393,"tag":427,"props":465,"children":467},{"style":466},"--shiki-default:#6A737D;--shiki-app-dark-mode:#6A737D",[468],{"type":398,"value":469},"# Simple sales data\n",{"type":393,"tag":427,"props":471,"children":472},{"class":429,"line":45},[473,478,483],{"type":393,"tag":427,"props":474,"children":475},{"style":439},[476],{"type":398,"value":477},"sales ",{"type":393,"tag":427,"props":479,"children":480},{"style":433},[481],{"type":398,"value":482},"=",{"type":393,"tag":427,"props":484,"children":485},{"style":439},[486],{"type":398,"value":487}," pd.DataFrame({\n",{"type":393,"tag":427,"props":489,"children":490},{"class":429,"line":54},[491,497,502,507,512,517,521,525,529,534,538,542],{"type":393,"tag":427,"props":492,"children":494},{"style":493},"--shiki-default:#032F62;--shiki-app-dark-mode:#9ECBFF",[495],{"type":398,"value":496},"    'department'",{"type":393,"tag":427,"props":498,"children":499},{"style":439},[500],{"type":398,"value":501},": [",{"type":393,"tag":427,"props":503,"children":504},{"style":493},[505],{"type":398,"value":506},"'Sales'",{"type":393,"tag":427,"props":508,"children":509},{"style":439},[510],{"type":398,"value":511},", ",{"type":393,"tag":427,"props":513,"children":514},{"style":493},[515],{"type":398,"value":516},"'IT'",{"type":393,"tag":427,"props":518,"children":519},{"style":439},[520],{"type":398,"value":511},{"type":393,"tag":427,"props":522,"children":523},{"style":493},[524],{"type":398,"value":506},{"type":393,"tag":427,"props":526,"children":527},{"style":439},[528],{"type":398,"value":511},{"type":393,"tag":427,"props":530,"children":531},{"style":493},[532],{"type":398,"value":533},"'HR'",{"type":393,"tag":427,"props":535,"children":536},{"style":439},[537],{"type":398,"value":511},{"type":393,"tag":427,"props":539,"children":540},{"style":493},[541],{"type":398,"value":516},{"type":393,"tag":427,"props":543,"children":544},{"style":439},[545],{"type":398,"value":546},"],\n",{"type":393,"tag":427,"props":548,"children":549},{"class":429,"line":63},[550,555,559,564,568,573,577,582,586,591,595,600],{"type":393,"tag":427,"props":551,"children":552},{"style":493},[553],{"type":398,"value":554},"    'employee'",{"type":393,"tag":427,"props":556,"children":557},{"style":439},[558],{"type":398,"value":501},{"type":393,"tag":427,"props":560,"children":561},{"style":493},[562],{"type":398,"value":563},"'Alice'",{"type":393,"tag":427,"props":565,"children":566},{"style":439},[567],{"type":398,"value":511},{"type":393,"tag":427,"props":569,"children":570},{"style":493},[571],{"type":398,"value":572},"'Bob'",{"type":393,"tag":427,"props":574,"children":575},{"style":439},[576],{"type":398,"value":511},{"type":393,"tag":427,"props":578,"children":579},{"style":493},[580],{"type":398,"value":581},"'Charlie'",{"type":393,"tag":427,"props":583,"children":584},{"style":439},[585],{"type":398,"value":511},{"type":393,"tag":427,"props":587,"children":588},{"style":493},[589],{"type":398,"value":590},"'Diana'",{"type":393,"tag":427,"props":592,"children":593},{"style":439},[594],{"type":398,"value":511},{"type":393,"tag":427,"props":596,"children":597},{"style":493},[598],{"type":398,"value":599},"'Eve'",{"type":393,"tag":427,"props":601,"children":602},{"style":439},[603],{"type":398,"value":546},{"type":393,"tag":427,"props":605,"children":606},{"class":429,"line":72},[607,612,616,622,626,631,635,640,644,649,653,658],{"type":393,"tag":427,"props":608,"children":609},{"style":493},[610],{"type":398,"value":611},"    'revenue'",{"type":393,"tag":427,"props":613,"children":614},{"style":439},[615],{"type":398,"value":501},{"type":393,"tag":427,"props":617,"children":619},{"style":618},"--shiki-default:#005CC5;--shiki-app-dark-mode:#79B8FF",[620],{"type":398,"value":621},"50000",{"type":393,"tag":427,"props":623,"children":624},{"style":439},[625],{"type":398,"value":511},{"type":393,"tag":427,"props":627,"children":628},{"style":618},[629],{"type":398,"value":630},"75000",{"type":393,"tag":427,"props":632,"children":633},{"style":439},[634],{"type":398,"value":511},{"type":393,"tag":427,"props":636,"children":637},{"style":618},[638],{"type":398,"value":639},"45000",{"type":393,"tag":427,"props":641,"children":642},{"style":439},[643],{"type":398,"value":511},{"type":393,"tag":427,"props":645,"children":646},{"style":618},[647],{"type":398,"value":648},"30000",{"type":393,"tag":427,"props":650,"children":651},{"style":439},[652],{"type":398,"value":511},{"type":393,"tag":427,"props":654,"children":655},{"style":618},[656],{"type":398,"value":657},"80000",{"type":393,"tag":427,"props":659,"children":660},{"style":439},[661],{"type":398,"value":662},"]\n",{"type":393,"tag":427,"props":664,"children":665},{"class":429,"line":83},[666],{"type":393,"tag":427,"props":667,"children":668},{"style":439},[669],{"type":398,"value":670},"})\n",{"type":393,"tag":427,"props":672,"children":673},{"class":429,"line":92},[674],{"type":393,"tag":427,"props":675,"children":676},{"emptyLinePlaceholder":12},[677],{"type":398,"value":460},{"type":393,"tag":427,"props":679,"children":680},{"class":429,"line":101},[681,686,691,696],{"type":393,"tag":427,"props":682,"children":683},{"style":618},[684],{"type":398,"value":685},"print",{"type":393,"tag":427,"props":687,"children":688},{"style":439},[689],{"type":398,"value":690},"(",{"type":393,"tag":427,"props":692,"children":693},{"style":493},[694],{"type":398,"value":695},"\"Sales data:\"",{"type":393,"tag":427,"props":697,"children":698},{"style":439},[699],{"type":398,"value":700},")\n",{"type":393,"tag":427,"props":702,"children":703},{"class":429,"line":110},[704,708],{"type":393,"tag":427,"props":705,"children":706},{"style":618},[707],{"type":398,"value":685},{"type":393,"tag":427,"props":709,"children":710},{"style":439},[711],{"type":398,"value":712},"(sales)\n",{"type":393,"tag":427,"props":714,"children":715},{"class":429,"line":121},[716,720],{"type":393,"tag":427,"props":717,"children":718},{"style":618},[719],{"type":398,"value":685},{"type":393,"tag":427,"props":721,"children":722},{"style":439},[723],{"type":398,"value":724},"()\n",{"type":393,"tag":427,"props":726,"children":727},{"class":429,"line":130},[728],{"type":393,"tag":427,"props":729,"children":730},{"emptyLinePlaceholder":12},[731],{"type":398,"value":460},{"type":393,"tag":427,"props":733,"children":734},{"class":429,"line":139},[735],{"type":393,"tag":427,"props":736,"children":737},{"style":466},[738],{"type":398,"value":739},"# Group by department and sum revenue\n",{"type":393,"tag":427,"props":741,"children":742},{"class":429,"line":148},[743,748,752,757,762,767,772],{"type":393,"tag":427,"props":744,"children":745},{"style":439},[746],{"type":398,"value":747},"dept_total ",{"type":393,"tag":427,"props":749,"children":750},{"style":433},[751],{"type":398,"value":482},{"type":393,"tag":427,"props":753,"children":754},{"style":439},[755],{"type":398,"value":756}," sales.groupby(",{"type":393,"tag":427,"props":758,"children":759},{"style":493},[760],{"type":398,"value":761},"'department'",{"type":393,"tag":427,"props":763,"children":764},{"style":439},[765],{"type":398,"value":766},")[",{"type":393,"tag":427,"props":768,"children":769},{"style":493},[770],{"type":398,"value":771},"'revenue'",{"type":393,"tag":427,"props":773,"children":774},{"style":439},[775],{"type":398,"value":776},"].sum()\n",{"type":393,"tag":427,"props":778,"children":779},{"class":429,"line":159},[780,784,788,793],{"type":393,"tag":427,"props":781,"children":782},{"style":618},[783],{"type":398,"value":685},{"type":393,"tag":427,"props":785,"children":786},{"style":439},[787],{"type":398,"value":690},{"type":393,"tag":427,"props":789,"children":790},{"style":493},[791],{"type":398,"value":792},"\"Total revenue by department:\"",{"type":393,"tag":427,"props":794,"children":795},{"style":439},[796],{"type":398,"value":700},{"type":393,"tag":427,"props":798,"children":799},{"class":429,"line":168},[800,804],{"type":393,"tag":427,"props":801,"children":802},{"style":618},[803],{"type":398,"value":685},{"type":393,"tag":427,"props":805,"children":806},{"style":439},[807],{"type":398,"value":808},"(dept_total)\n",{"type":393,"tag":810,"props":811,"children":813},"h2",{"id":812},"understanding-groupby",[814],{"type":398,"value":815},"🎯 Understanding GroupBy",{"type":393,"tag":401,"props":817,"children":818},{},[819],{"type":398,"value":820},"GroupBy works in three steps: Split, Apply, Combine.",{"type":393,"tag":822,"props":823,"children":827},"info-box",{"emoji":824,"title":825,"type":826},"🔄","The GroupBy Process","info",[828,837,857,865,883,891,909],{"type":393,"tag":401,"props":829,"children":830},{},[831],{"type":393,"tag":832,"props":833,"children":834},"strong",{},[835],{"type":398,"value":836},"Step 1: Split",{"type":393,"tag":838,"props":839,"children":840},"ul",{},[841,847,852],{"type":393,"tag":842,"props":843,"children":844},"li",{},[845],{"type":398,"value":846},"Pandas looks at your grouping column",{"type":393,"tag":842,"props":848,"children":849},{},[850],{"type":398,"value":851},"Creates separate groups for each unique value",{"type":393,"tag":842,"props":853,"children":854},{},[855],{"type":398,"value":856},"Example: 'Sales', 'IT', 'HR' become 3 groups",{"type":393,"tag":401,"props":858,"children":859},{},[860],{"type":393,"tag":832,"props":861,"children":862},{},[863],{"type":398,"value":864},"Step 2: Apply",{"type":393,"tag":838,"props":866,"children":867},{},[868,873,878],{"type":393,"tag":842,"props":869,"children":870},{},[871],{"type":398,"value":872},"Applies a function to each group",{"type":393,"tag":842,"props":874,"children":875},{},[876],{"type":398,"value":877},"Could be sum(), mean(), count(), etc.",{"type":393,"tag":842,"props":879,"children":880},{},[881],{"type":398,"value":882},"Each group gets calculated separately",{"type":393,"tag":401,"props":884,"children":885},{},[886],{"type":393,"tag":832,"props":887,"children":888},{},[889],{"type":398,"value":890},"Step 3: Combine",{"type":393,"tag":838,"props":892,"children":893},{},[894,899,904],{"type":393,"tag":842,"props":895,"children":896},{},[897],{"type":398,"value":898},"Combines results into a new Series or DataFrame",{"type":393,"tag":842,"props":900,"children":901},{},[902],{"type":398,"value":903},"One result per group",{"type":393,"tag":842,"props":905,"children":906},{},[907],{"type":398,"value":908},"Index shows the group names",{"type":393,"tag":401,"props":910,"children":911},{},[912,917],{"type":393,"tag":832,"props":913,"children":914},{},[915],{"type":398,"value":916},"Result:",{"type":398,"value":918}," Clean summary with one row per group!",{"type":393,"tag":810,"props":920,"children":922},{"id":921},"basic-groupby-syntax",[923],{"type":398,"value":924},"📊 Basic GroupBy Syntax",{"type":393,"tag":401,"props":926,"children":927},{},[928,930],{"type":398,"value":929},"The basic syntax is simple: ",{"type":393,"tag":423,"props":931,"children":933},{"className":932},[],[934],{"type":398,"value":935},"df.groupby('column')['target_column'].function()",{"type":393,"tag":412,"props":937,"children":938},{},[939],{"type":393,"tag":416,"props":940,"children":942},{"className":418,"code":941,"language":420,"meta":6,"style":6},"import pandas as pd\n\n# Customer orders\norders = pd.DataFrame({\n    'customer': ['Alice', 'Bob', 'Alice', 'Charlie', 'Bob'],\n    'product': ['Laptop', 'Mouse', 'Keyboard', 'Monitor', 'Laptop'],\n    'amount': [999, 25, 75, 300, 999]\n})\n\nprint(\"Customer orders:\")\nprint(orders)\nprint()\n\n# Different GroupBy operations\nprint(\"Total spent per customer:\")\nprint(orders.groupby('customer')['amount'].sum())\nprint()\n\nprint(\"Average order per customer:\")\nprint(orders.groupby('customer')['amount'].mean())\nprint()\n\nprint(\"Number of orders per customer:\")\nprint(orders.groupby('customer').size())\n",[943],{"type":393,"tag":423,"props":944,"children":945},{"__ignoreMap":6},[946,965,972,980,996,1048,1104,1160,1167,1174,1194,1206,1217,1224,1232,1252,1283,1294,1301,1321,1349,1360,1367,1387],{"type":393,"tag":427,"props":947,"children":948},{"class":429,"line":11},[949,953,957,961],{"type":393,"tag":427,"props":950,"children":951},{"style":433},[952],{"type":398,"value":436},{"type":393,"tag":427,"props":954,"children":955},{"style":439},[956],{"type":398,"value":442},{"type":393,"tag":427,"props":958,"children":959},{"style":433},[960],{"type":398,"value":447},{"type":393,"tag":427,"props":962,"children":963},{"style":439},[964],{"type":398,"value":452},{"type":393,"tag":427,"props":966,"children":967},{"class":429,"line":27},[968],{"type":393,"tag":427,"props":969,"children":970},{"emptyLinePlaceholder":12},[971],{"type":398,"value":460},{"type":393,"tag":427,"props":973,"children":974},{"class":429,"line":36},[975],{"type":393,"tag":427,"props":976,"children":977},{"style":466},[978],{"type":398,"value":979},"# Customer orders\n",{"type":393,"tag":427,"props":981,"children":982},{"class":429,"line":45},[983,988,992],{"type":393,"tag":427,"props":984,"children":985},{"style":439},[986],{"type":398,"value":987},"orders ",{"type":393,"tag":427,"props":989,"children":990},{"style":433},[991],{"type":398,"value":482},{"type":393,"tag":427,"props":993,"children":994},{"style":439},[995],{"type":398,"value":487},{"type":393,"tag":427,"props":997,"children":998},{"class":429,"line":54},[999,1004,1008,1012,1016,1020,1024,1028,1032,1036,1040,1044],{"type":393,"tag":427,"props":1000,"children":1001},{"style":493},[1002],{"type":398,"value":1003},"    'customer'",{"type":393,"tag":427,"props":1005,"children":1006},{"style":439},[1007],{"type":398,"value":501},{"type":393,"tag":427,"props":1009,"children":1010},{"style":493},[1011],{"type":398,"value":563},{"type":393,"tag":427,"props":1013,"children":1014},{"style":439},[1015],{"type":398,"value":511},{"type":393,"tag":427,"props":1017,"children":1018},{"style":493},[1019],{"type":398,"value":572},{"type":393,"tag":427,"props":1021,"children":1022},{"style":439},[1023],{"type":398,"value":511},{"type":393,"tag":427,"props":1025,"children":1026},{"style":493},[1027],{"type":398,"value":563},{"type":393,"tag":427,"props":1029,"children":1030},{"style":439},[1031],{"type":398,"value":511},{"type":393,"tag":427,"props":1033,"children":1034},{"style":493},[1035],{"type":398,"value":581},{"type":393,"tag":427,"props":1037,"children":1038},{"style":439},[1039],{"type":398,"value":511},{"type":393,"tag":427,"props":1041,"children":1042},{"style":493},[1043],{"type":398,"value":572},{"type":393,"tag":427,"props":1045,"children":1046},{"style":439},[1047],{"type":398,"value":546},{"type":393,"tag":427,"props":1049,"children":1050},{"class":429,"line":63},[1051,1056,1060,1065,1069,1074,1078,1083,1087,1092,1096,1100],{"type":393,"tag":427,"props":1052,"children":1053},{"style":493},[1054],{"type":398,"value":1055},"    'product'",{"type":393,"tag":427,"props":1057,"children":1058},{"style":439},[1059],{"type":398,"value":501},{"type":393,"tag":427,"props":1061,"children":1062},{"style":493},[1063],{"type":398,"value":1064},"'Laptop'",{"type":393,"tag":427,"props":1066,"children":1067},{"style":439},[1068],{"type":398,"value":511},{"type":393,"tag":427,"props":1070,"children":1071},{"style":493},[1072],{"type":398,"value":1073},"'Mouse'",{"type":393,"tag":427,"props":1075,"children":1076},{"style":439},[1077],{"type":398,"value":511},{"type":393,"tag":427,"props":1079,"children":1080},{"style":493},[1081],{"type":398,"value":1082},"'Keyboard'",{"type":393,"tag":427,"props":1084,"children":1085},{"style":439},[1086],{"type":398,"value":511},{"type":393,"tag":427,"props":1088,"children":1089},{"style":493},[1090],{"type":398,"value":1091},"'Monitor'",{"type":393,"tag":427,"props":1093,"children":1094},{"style":439},[1095],{"type":398,"value":511},{"type":393,"tag":427,"props":1097,"children":1098},{"style":493},[1099],{"type":398,"value":1064},{"type":393,"tag":427,"props":1101,"children":1102},{"style":439},[1103],{"type":398,"value":546},{"type":393,"tag":427,"props":1105,"children":1106},{"class":429,"line":72},[1107,1112,1116,1121,1125,1130,1134,1139,1143,1148,1152,1156],{"type":393,"tag":427,"props":1108,"children":1109},{"style":493},[1110],{"type":398,"value":1111},"    'amount'",{"type":393,"tag":427,"props":1113,"children":1114},{"style":439},[1115],{"type":398,"value":501},{"type":393,"tag":427,"props":1117,"children":1118},{"style":618},[1119],{"type":398,"value":1120},"999",{"type":393,"tag":427,"props":1122,"children":1123},{"style":439},[1124],{"type":398,"value":511},{"type":393,"tag":427,"props":1126,"children":1127},{"style":618},[1128],{"type":398,"value":1129},"25",{"type":393,"tag":427,"props":1131,"children":1132},{"style":439},[1133],{"type":398,"value":511},{"type":393,"tag":427,"props":1135,"children":1136},{"style":618},[1137],{"type":398,"value":1138},"75",{"type":393,"tag":427,"props":1140,"children":1141},{"style":439},[1142],{"type":398,"value":511},{"type":393,"tag":427,"props":1144,"children":1145},{"style":618},[1146],{"type":398,"value":1147},"300",{"type":393,"tag":427,"props":1149,"children":1150},{"style":439},[1151],{"type":398,"value":511},{"type":393,"tag":427,"props":1153,"children":1154},{"style":618},[1155],{"type":398,"value":1120},{"type":393,"tag":427,"props":1157,"children":1158},{"style":439},[1159],{"type":398,"value":662},{"type":393,"tag":427,"props":1161,"children":1162},{"class":429,"line":83},[1163],{"type":393,"tag":427,"props":1164,"children":1165},{"style":439},[1166],{"type":398,"value":670},{"type":393,"tag":427,"props":1168,"children":1169},{"class":429,"line":92},[1170],{"type":393,"tag":427,"props":1171,"children":1172},{"emptyLinePlaceholder":12},[1173],{"type":398,"value":460},{"type":393,"tag":427,"props":1175,"children":1176},{"class":429,"line":101},[1177,1181,1185,1190],{"type":393,"tag":427,"props":1178,"children":1179},{"style":618},[1180],{"type":398,"value":685},{"type":393,"tag":427,"props":1182,"children":1183},{"style":439},[1184],{"type":398,"value":690},{"type":393,"tag":427,"props":1186,"children":1187},{"style":493},[1188],{"type":398,"value":1189},"\"Customer orders:\"",{"type":393,"tag":427,"props":1191,"children":1192},{"style":439},[1193],{"type":398,"value":700},{"type":393,"tag":427,"props":1195,"children":1196},{"class":429,"line":110},[1197,1201],{"type":393,"tag":427,"props":1198,"children":1199},{"style":618},[1200],{"type":398,"value":685},{"type":393,"tag":427,"props":1202,"children":1203},{"style":439},[1204],{"type":398,"value":1205},"(orders)\n",{"type":393,"tag":427,"props":1207,"children":1208},{"class":429,"line":121},[1209,1213],{"type":393,"tag":427,"props":1210,"children":1211},{"style":618},[1212],{"type":398,"value":685},{"type":393,"tag":427,"props":1214,"children":1215},{"style":439},[1216],{"type":398,"value":724},{"type":393,"tag":427,"props":1218,"children":1219},{"class":429,"line":130},[1220],{"type":393,"tag":427,"props":1221,"children":1222},{"emptyLinePlaceholder":12},[1223],{"type":398,"value":460},{"type":393,"tag":427,"props":1225,"children":1226},{"class":429,"line":139},[1227],{"type":393,"tag":427,"props":1228,"children":1229},{"style":466},[1230],{"type":398,"value":1231},"# Different GroupBy operations\n",{"type":393,"tag":427,"props":1233,"children":1234},{"class":429,"line":148},[1235,1239,1243,1248],{"type":393,"tag":427,"props":1236,"children":1237},{"style":618},[1238],{"type":398,"value":685},{"type":393,"tag":427,"props":1240,"children":1241},{"style":439},[1242],{"type":398,"value":690},{"type":393,"tag":427,"props":1244,"children":1245},{"style":493},[1246],{"type":398,"value":1247},"\"Total spent per customer:\"",{"type":393,"tag":427,"props":1249,"children":1250},{"style":439},[1251],{"type":398,"value":700},{"type":393,"tag":427,"props":1253,"children":1254},{"class":429,"line":159},[1255,1259,1264,1269,1273,1278],{"type":393,"tag":427,"props":1256,"children":1257},{"style":618},[1258],{"type":398,"value":685},{"type":393,"tag":427,"props":1260,"children":1261},{"style":439},[1262],{"type":398,"value":1263},"(orders.groupby(",{"type":393,"tag":427,"props":1265,"children":1266},{"style":493},[1267],{"type":398,"value":1268},"'customer'",{"type":393,"tag":427,"props":1270,"children":1271},{"style":439},[1272],{"type":398,"value":766},{"type":393,"tag":427,"props":1274,"children":1275},{"style":493},[1276],{"type":398,"value":1277},"'amount'",{"type":393,"tag":427,"props":1279,"children":1280},{"style":439},[1281],{"type":398,"value":1282},"].sum())\n",{"type":393,"tag":427,"props":1284,"children":1285},{"class":429,"line":168},[1286,1290],{"type":393,"tag":427,"props":1287,"children":1288},{"style":618},[1289],{"type":398,"value":685},{"type":393,"tag":427,"props":1291,"children":1292},{"style":439},[1293],{"type":398,"value":724},{"type":393,"tag":427,"props":1295,"children":1296},{"class":429,"line":177},[1297],{"type":393,"tag":427,"props":1298,"children":1299},{"emptyLinePlaceholder":12},[1300],{"type":398,"value":460},{"type":393,"tag":427,"props":1302,"children":1303},{"class":429,"line":186},[1304,1308,1312,1317],{"type":393,"tag":427,"props":1305,"children":1306},{"style":618},[1307],{"type":398,"value":685},{"type":393,"tag":427,"props":1309,"children":1310},{"style":439},[1311],{"type":398,"value":690},{"type":393,"tag":427,"props":1313,"children":1314},{"style":493},[1315],{"type":398,"value":1316},"\"Average order per customer:\"",{"type":393,"tag":427,"props":1318,"children":1319},{"style":439},[1320],{"type":398,"value":700},{"type":393,"tag":427,"props":1322,"children":1323},{"class":429,"line":197},[1324,1328,1332,1336,1340,1344],{"type":393,"tag":427,"props":1325,"children":1326},{"style":618},[1327],{"type":398,"value":685},{"type":393,"tag":427,"props":1329,"children":1330},{"style":439},[1331],{"type":398,"value":1263},{"type":393,"tag":427,"props":1333,"children":1334},{"style":493},[1335],{"type":398,"value":1268},{"type":393,"tag":427,"props":1337,"children":1338},{"style":439},[1339],{"type":398,"value":766},{"type":393,"tag":427,"props":1341,"children":1342},{"style":493},[1343],{"type":398,"value":1277},{"type":393,"tag":427,"props":1345,"children":1346},{"style":439},[1347],{"type":398,"value":1348},"].mean())\n",{"type":393,"tag":427,"props":1350,"children":1351},{"class":429,"line":206},[1352,1356],{"type":393,"tag":427,"props":1353,"children":1354},{"style":618},[1355],{"type":398,"value":685},{"type":393,"tag":427,"props":1357,"children":1358},{"style":439},[1359],{"type":398,"value":724},{"type":393,"tag":427,"props":1361,"children":1362},{"class":429,"line":215},[1363],{"type":393,"tag":427,"props":1364,"children":1365},{"emptyLinePlaceholder":12},[1366],{"type":398,"value":460},{"type":393,"tag":427,"props":1368,"children":1369},{"class":429,"line":224},[1370,1374,1378,1383],{"type":393,"tag":427,"props":1371,"children":1372},{"style":618},[1373],{"type":398,"value":685},{"type":393,"tag":427,"props":1375,"children":1376},{"style":439},[1377],{"type":398,"value":690},{"type":393,"tag":427,"props":1379,"children":1380},{"style":493},[1381],{"type":398,"value":1382},"\"Number of orders per customer:\"",{"type":393,"tag":427,"props":1384,"children":1385},{"style":439},[1386],{"type":398,"value":700},{"type":393,"tag":427,"props":1388,"children":1389},{"class":429,"line":233},[1390,1394,1398,1402],{"type":393,"tag":427,"props":1391,"children":1392},{"style":618},[1393],{"type":398,"value":685},{"type":393,"tag":427,"props":1395,"children":1396},{"style":439},[1397],{"type":398,"value":1263},{"type":393,"tag":427,"props":1399,"children":1400},{"style":493},[1401],{"type":398,"value":1268},{"type":393,"tag":427,"props":1403,"children":1404},{"style":439},[1405],{"type":398,"value":1406},").size())\n",{"type":393,"tag":810,"props":1408,"children":1410},{"id":1409},"common-aggregation-functions",[1411],{"type":398,"value":1412},"🔢 Common Aggregation Functions",{"type":393,"tag":401,"props":1414,"children":1415},{},[1416],{"type":398,"value":1417},"Here are the most useful functions for GroupBy operations:",{"type":393,"tag":822,"props":1419,"children":1423},{"emoji":1420,"title":1421,"type":1422},"📊","Essential Aggregation Functions","success",[1424,1432,1486,1494,1530,1538,1570,1578],{"type":393,"tag":401,"props":1425,"children":1426},{},[1427],{"type":393,"tag":832,"props":1428,"children":1429},{},[1430],{"type":398,"value":1431},"Mathematical:",{"type":393,"tag":838,"props":1433,"children":1434},{},[1435,1446,1457,1475],{"type":393,"tag":842,"props":1436,"children":1437},{},[1438,1444],{"type":393,"tag":423,"props":1439,"children":1441},{"className":1440},[],[1442],{"type":398,"value":1443},".sum()",{"type":398,"value":1445}," - Add up all values in each group",{"type":393,"tag":842,"props":1447,"children":1448},{},[1449,1455],{"type":393,"tag":423,"props":1450,"children":1452},{"className":1451},[],[1453],{"type":398,"value":1454},".mean()",{"type":398,"value":1456}," - Average value per group",{"type":393,"tag":842,"props":1458,"children":1459},{},[1460,1466,1467,1473],{"type":393,"tag":423,"props":1461,"children":1463},{"className":1462},[],[1464],{"type":398,"value":1465},".min()",{"type":398,"value":511},{"type":393,"tag":423,"props":1468,"children":1470},{"className":1469},[],[1471],{"type":398,"value":1472},".max()",{"type":398,"value":1474}," - Smallest/largest in each group",{"type":393,"tag":842,"props":1476,"children":1477},{},[1478,1484],{"type":393,"tag":423,"props":1479,"children":1481},{"className":1480},[],[1482],{"type":398,"value":1483},".std()",{"type":398,"value":1485}," - Standard deviation per group",{"type":393,"tag":401,"props":1487,"children":1488},{},[1489],{"type":393,"tag":832,"props":1490,"children":1491},{},[1492],{"type":398,"value":1493},"Counting:",{"type":393,"tag":838,"props":1495,"children":1496},{},[1497,1508,1519],{"type":393,"tag":842,"props":1498,"children":1499},{},[1500,1506],{"type":393,"tag":423,"props":1501,"children":1503},{"className":1502},[],[1504],{"type":398,"value":1505},".count()",{"type":398,"value":1507}," - Count non-null values per group",{"type":393,"tag":842,"props":1509,"children":1510},{},[1511,1517],{"type":393,"tag":423,"props":1512,"children":1514},{"className":1513},[],[1515],{"type":398,"value":1516},".size()",{"type":398,"value":1518}," - Count all rows per group (including nulls)",{"type":393,"tag":842,"props":1520,"children":1521},{},[1522,1528],{"type":393,"tag":423,"props":1523,"children":1525},{"className":1524},[],[1526],{"type":398,"value":1527},".nunique()",{"type":398,"value":1529}," - Count unique values per group",{"type":393,"tag":401,"props":1531,"children":1532},{},[1533],{"type":393,"tag":832,"props":1534,"children":1535},{},[1536],{"type":398,"value":1537},"Selection:",{"type":393,"tag":838,"props":1539,"children":1540},{},[1541,1559],{"type":393,"tag":842,"props":1542,"children":1543},{},[1544,1550,1551,1557],{"type":393,"tag":423,"props":1545,"children":1547},{"className":1546},[],[1548],{"type":398,"value":1549},".first()",{"type":398,"value":511},{"type":393,"tag":423,"props":1552,"children":1554},{"className":1553},[],[1555],{"type":398,"value":1556},".last()",{"type":398,"value":1558}," - First/last value in each group",{"type":393,"tag":842,"props":1560,"children":1561},{},[1562,1568],{"type":393,"tag":423,"props":1563,"children":1565},{"className":1564},[],[1566],{"type":398,"value":1567},".median()",{"type":398,"value":1569}," - Middle value per group",{"type":393,"tag":401,"props":1571,"children":1572},{},[1573],{"type":393,"tag":832,"props":1574,"children":1575},{},[1576],{"type":398,"value":1577},"Use Cases:",{"type":393,"tag":838,"props":1579,"children":1580},{},[1581,1586,1591],{"type":393,"tag":842,"props":1582,"children":1583},{},[1584],{"type":398,"value":1585},"sum() for totals (revenue, sales)",{"type":393,"tag":842,"props":1587,"children":1588},{},[1589],{"type":398,"value":1590},"mean() for averages (ratings, scores)",{"type":393,"tag":842,"props":1592,"children":1593},{},[1594],{"type":398,"value":1595},"count() for frequencies (number of transactions)",{"type":393,"tag":1597,"props":1598,"children":1600},"h3",{"id":1599},"mathematical-aggregations",[1601],{"type":398,"value":1602},"Mathematical Aggregations",{"type":393,"tag":412,"props":1604,"children":1605},{},[1606],{"type":393,"tag":416,"props":1607,"children":1609},{"className":418,"code":1608,"language":420,"meta":6,"style":6},"import pandas as pd\n\n# Employee data\nemployees = pd.DataFrame({\n    'department': ['Sales', 'IT', 'Sales', 'HR', 'IT', 'HR'],\n    'salary': [50000, 75000, 52000, 48000, 80000, 45000],\n    'experience': [2, 5, 3, 1, 7, 2]\n})\n\nprint(\"Employee data:\")\nprint(employees)\nprint()\n\n# Mathematical aggregations by department\nprint(\"Average salary by department:\")\nprint(employees.groupby('department')['salary'].mean())\nprint()\n\nprint(\"Salary range by department:\")\nsalary_range = employees.groupby('department')['salary'].agg(['min', 'max'])\nprint(salary_range)\n",[1610],{"type":393,"tag":423,"props":1611,"children":1612},{"__ignoreMap":6},[1613,1632,1639,1647,1663,1722,1784,1849,1856,1863,1883,1895,1906,1913,1921,1941,1970,1981,1988,2008,2061],{"type":393,"tag":427,"props":1614,"children":1615},{"class":429,"line":11},[1616,1620,1624,1628],{"type":393,"tag":427,"props":1617,"children":1618},{"style":433},[1619],{"type":398,"value":436},{"type":393,"tag":427,"props":1621,"children":1622},{"style":439},[1623],{"type":398,"value":442},{"type":393,"tag":427,"props":1625,"children":1626},{"style":433},[1627],{"type":398,"value":447},{"type":393,"tag":427,"props":1629,"children":1630},{"style":439},[1631],{"type":398,"value":452},{"type":393,"tag":427,"props":1633,"children":1634},{"class":429,"line":27},[1635],{"type":393,"tag":427,"props":1636,"children":1637},{"emptyLinePlaceholder":12},[1638],{"type":398,"value":460},{"type":393,"tag":427,"props":1640,"children":1641},{"class":429,"line":36},[1642],{"type":393,"tag":427,"props":1643,"children":1644},{"style":466},[1645],{"type":398,"value":1646},"# Employee data\n",{"type":393,"tag":427,"props":1648,"children":1649},{"class":429,"line":45},[1650,1655,1659],{"type":393,"tag":427,"props":1651,"children":1652},{"style":439},[1653],{"type":398,"value":1654},"employees ",{"type":393,"tag":427,"props":1656,"children":1657},{"style":433},[1658],{"type":398,"value":482},{"type":393,"tag":427,"props":1660,"children":1661},{"style":439},[1662],{"type":398,"value":487},{"type":393,"tag":427,"props":1664,"children":1665},{"class":429,"line":54},[1666,1670,1674,1678,1682,1686,1690,1694,1698,1702,1706,1710,1714,1718],{"type":393,"tag":427,"props":1667,"children":1668},{"style":493},[1669],{"type":398,"value":496},{"type":393,"tag":427,"props":1671,"children":1672},{"style":439},[1673],{"type":398,"value":501},{"type":393,"tag":427,"props":1675,"children":1676},{"style":493},[1677],{"type":398,"value":506},{"type":393,"tag":427,"props":1679,"children":1680},{"style":439},[1681],{"type":398,"value":511},{"type":393,"tag":427,"props":1683,"children":1684},{"style":493},[1685],{"type":398,"value":516},{"type":393,"tag":427,"props":1687,"children":1688},{"style":439},[1689],{"type":398,"value":511},{"type":393,"tag":427,"props":1691,"children":1692},{"style":493},[1693],{"type":398,"value":506},{"type":393,"tag":427,"props":1695,"children":1696},{"style":439},[1697],{"type":398,"value":511},{"type":393,"tag":427,"props":1699,"children":1700},{"style":493},[1701],{"type":398,"value":533},{"type":393,"tag":427,"props":1703,"children":1704},{"style":439},[1705],{"type":398,"value":511},{"type":393,"tag":427,"props":1707,"children":1708},{"style":493},[1709],{"type":398,"value":516},{"type":393,"tag":427,"props":1711,"children":1712},{"style":439},[1713],{"type":398,"value":511},{"type":393,"tag":427,"props":1715,"children":1716},{"style":493},[1717],{"type":398,"value":533},{"type":393,"tag":427,"props":1719,"children":1720},{"style":439},[1721],{"type":398,"value":546},{"type":393,"tag":427,"props":1723,"children":1724},{"class":429,"line":63},[1725,1730,1734,1738,1742,1746,1750,1755,1759,1764,1768,1772,1776,1780],{"type":393,"tag":427,"props":1726,"children":1727},{"style":493},[1728],{"type":398,"value":1729},"    'salary'",{"type":393,"tag":427,"props":1731,"children":1732},{"style":439},[1733],{"type":398,"value":501},{"type":393,"tag":427,"props":1735,"children":1736},{"style":618},[1737],{"type":398,"value":621},{"type":393,"tag":427,"props":1739,"children":1740},{"style":439},[1741],{"type":398,"value":511},{"type":393,"tag":427,"props":1743,"children":1744},{"style":618},[1745],{"type":398,"value":630},{"type":393,"tag":427,"props":1747,"children":1748},{"style":439},[1749],{"type":398,"value":511},{"type":393,"tag":427,"props":1751,"children":1752},{"style":618},[1753],{"type":398,"value":1754},"52000",{"type":393,"tag":427,"props":1756,"children":1757},{"style":439},[1758],{"type":398,"value":511},{"type":393,"tag":427,"props":1760,"children":1761},{"style":618},[1762],{"type":398,"value":1763},"48000",{"type":393,"tag":427,"props":1765,"children":1766},{"style":439},[1767],{"type":398,"value":511},{"type":393,"tag":427,"props":1769,"children":1770},{"style":618},[1771],{"type":398,"value":657},{"type":393,"tag":427,"props":1773,"children":1774},{"style":439},[1775],{"type":398,"value":511},{"type":393,"tag":427,"props":1777,"children":1778},{"style":618},[1779],{"type":398,"value":639},{"type":393,"tag":427,"props":1781,"children":1782},{"style":439},[1783],{"type":398,"value":546},{"type":393,"tag":427,"props":1785,"children":1786},{"class":429,"line":72},[1787,1792,1796,1801,1805,1810,1814,1819,1823,1828,1832,1837,1841,1845],{"type":393,"tag":427,"props":1788,"children":1789},{"style":493},[1790],{"type":398,"value":1791},"    'experience'",{"type":393,"tag":427,"props":1793,"children":1794},{"style":439},[1795],{"type":398,"value":501},{"type":393,"tag":427,"props":1797,"children":1798},{"style":618},[1799],{"type":398,"value":1800},"2",{"type":393,"tag":427,"props":1802,"children":1803},{"style":439},[1804],{"type":398,"value":511},{"type":393,"tag":427,"props":1806,"children":1807},{"style":618},[1808],{"type":398,"value":1809},"5",{"type":393,"tag":427,"props":1811,"children":1812},{"style":439},[1813],{"type":398,"value":511},{"type":393,"tag":427,"props":1815,"children":1816},{"style":618},[1817],{"type":398,"value":1818},"3",{"type":393,"tag":427,"props":1820,"children":1821},{"style":439},[1822],{"type":398,"value":511},{"type":393,"tag":427,"props":1824,"children":1825},{"style":618},[1826],{"type":398,"value":1827},"1",{"type":393,"tag":427,"props":1829,"children":1830},{"style":439},[1831],{"type":398,"value":511},{"type":393,"tag":427,"props":1833,"children":1834},{"style":618},[1835],{"type":398,"value":1836},"7",{"type":393,"tag":427,"props":1838,"children":1839},{"style":439},[1840],{"type":398,"value":511},{"type":393,"tag":427,"props":1842,"children":1843},{"style":618},[1844],{"type":398,"value":1800},{"type":393,"tag":427,"props":1846,"children":1847},{"style":439},[1848],{"type":398,"value":662},{"type":393,"tag":427,"props":1850,"children":1851},{"class":429,"line":83},[1852],{"type":393,"tag":427,"props":1853,"children":1854},{"style":439},[1855],{"type":398,"value":670},{"type":393,"tag":427,"props":1857,"children":1858},{"class":429,"line":92},[1859],{"type":393,"tag":427,"props":1860,"children":1861},{"emptyLinePlaceholder":12},[1862],{"type":398,"value":460},{"type":393,"tag":427,"props":1864,"children":1865},{"class":429,"line":101},[1866,1870,1874,1879],{"type":393,"tag":427,"props":1867,"children":1868},{"style":618},[1869],{"type":398,"value":685},{"type":393,"tag":427,"props":1871,"children":1872},{"style":439},[1873],{"type":398,"value":690},{"type":393,"tag":427,"props":1875,"children":1876},{"style":493},[1877],{"type":398,"value":1878},"\"Employee data:\"",{"type":393,"tag":427,"props":1880,"children":1881},{"style":439},[1882],{"type":398,"value":700},{"type":393,"tag":427,"props":1884,"children":1885},{"class":429,"line":110},[1886,1890],{"type":393,"tag":427,"props":1887,"children":1888},{"style":618},[1889],{"type":398,"value":685},{"type":393,"tag":427,"props":1891,"children":1892},{"style":439},[1893],{"type":398,"value":1894},"(employees)\n",{"type":393,"tag":427,"props":1896,"children":1897},{"class":429,"line":121},[1898,1902],{"type":393,"tag":427,"props":1899,"children":1900},{"style":618},[1901],{"type":398,"value":685},{"type":393,"tag":427,"props":1903,"children":1904},{"style":439},[1905],{"type":398,"value":724},{"type":393,"tag":427,"props":1907,"children":1908},{"class":429,"line":130},[1909],{"type":393,"tag":427,"props":1910,"children":1911},{"emptyLinePlaceholder":12},[1912],{"type":398,"value":460},{"type":393,"tag":427,"props":1914,"children":1915},{"class":429,"line":139},[1916],{"type":393,"tag":427,"props":1917,"children":1918},{"style":466},[1919],{"type":398,"value":1920},"# Mathematical aggregations by department\n",{"type":393,"tag":427,"props":1922,"children":1923},{"class":429,"line":148},[1924,1928,1932,1937],{"type":393,"tag":427,"props":1925,"children":1926},{"style":618},[1927],{"type":398,"value":685},{"type":393,"tag":427,"props":1929,"children":1930},{"style":439},[1931],{"type":398,"value":690},{"type":393,"tag":427,"props":1933,"children":1934},{"style":493},[1935],{"type":398,"value":1936},"\"Average salary by department:\"",{"type":393,"tag":427,"props":1938,"children":1939},{"style":439},[1940],{"type":398,"value":700},{"type":393,"tag":427,"props":1942,"children":1943},{"class":429,"line":159},[1944,1948,1953,1957,1961,1966],{"type":393,"tag":427,"props":1945,"children":1946},{"style":618},[1947],{"type":398,"value":685},{"type":393,"tag":427,"props":1949,"children":1950},{"style":439},[1951],{"type":398,"value":1952},"(employees.groupby(",{"type":393,"tag":427,"props":1954,"children":1955},{"style":493},[1956],{"type":398,"value":761},{"type":393,"tag":427,"props":1958,"children":1959},{"style":439},[1960],{"type":398,"value":766},{"type":393,"tag":427,"props":1962,"children":1963},{"style":493},[1964],{"type":398,"value":1965},"'salary'",{"type":393,"tag":427,"props":1967,"children":1968},{"style":439},[1969],{"type":398,"value":1348},{"type":393,"tag":427,"props":1971,"children":1972},{"class":429,"line":168},[1973,1977],{"type":393,"tag":427,"props":1974,"children":1975},{"style":618},[1976],{"type":398,"value":685},{"type":393,"tag":427,"props":1978,"children":1979},{"style":439},[1980],{"type":398,"value":724},{"type":393,"tag":427,"props":1982,"children":1983},{"class":429,"line":177},[1984],{"type":393,"tag":427,"props":1985,"children":1986},{"emptyLinePlaceholder":12},[1987],{"type":398,"value":460},{"type":393,"tag":427,"props":1989,"children":1990},{"class":429,"line":186},[1991,1995,1999,2004],{"type":393,"tag":427,"props":1992,"children":1993},{"style":618},[1994],{"type":398,"value":685},{"type":393,"tag":427,"props":1996,"children":1997},{"style":439},[1998],{"type":398,"value":690},{"type":393,"tag":427,"props":2000,"children":2001},{"style":493},[2002],{"type":398,"value":2003},"\"Salary range by department:\"",{"type":393,"tag":427,"props":2005,"children":2006},{"style":439},[2007],{"type":398,"value":700},{"type":393,"tag":427,"props":2009,"children":2010},{"class":429,"line":197},[2011,2016,2020,2025,2029,2033,2037,2042,2047,2051,2056],{"type":393,"tag":427,"props":2012,"children":2013},{"style":439},[2014],{"type":398,"value":2015},"salary_range ",{"type":393,"tag":427,"props":2017,"children":2018},{"style":433},[2019],{"type":398,"value":482},{"type":393,"tag":427,"props":2021,"children":2022},{"style":439},[2023],{"type":398,"value":2024}," employees.groupby(",{"type":393,"tag":427,"props":2026,"children":2027},{"style":493},[2028],{"type":398,"value":761},{"type":393,"tag":427,"props":2030,"children":2031},{"style":439},[2032],{"type":398,"value":766},{"type":393,"tag":427,"props":2034,"children":2035},{"style":493},[2036],{"type":398,"value":1965},{"type":393,"tag":427,"props":2038,"children":2039},{"style":439},[2040],{"type":398,"value":2041},"].agg([",{"type":393,"tag":427,"props":2043,"children":2044},{"style":493},[2045],{"type":398,"value":2046},"'min'",{"type":393,"tag":427,"props":2048,"children":2049},{"style":439},[2050],{"type":398,"value":511},{"type":393,"tag":427,"props":2052,"children":2053},{"style":493},[2054],{"type":398,"value":2055},"'max'",{"type":393,"tag":427,"props":2057,"children":2058},{"style":439},[2059],{"type":398,"value":2060},"])\n",{"type":393,"tag":427,"props":2062,"children":2063},{"class":429,"line":206},[2064,2068],{"type":393,"tag":427,"props":2065,"children":2066},{"style":618},[2067],{"type":398,"value":685},{"type":393,"tag":427,"props":2069,"children":2070},{"style":439},[2071],{"type":398,"value":2072},"(salary_range)\n",{"type":393,"tag":1597,"props":2074,"children":2076},{"id":2075},"counting-operations",[2077],{"type":398,"value":2078},"Counting Operations",{"type":393,"tag":412,"props":2080,"children":2081},{},[2082],{"type":393,"tag":416,"props":2083,"children":2085},{"className":418,"code":2084,"language":420,"meta":6,"style":6},"import pandas as pd\n\n# Product reviews\nreviews = pd.DataFrame({\n    'product': ['Laptop', 'Mouse', 'Laptop', 'Keyboard', 'Mouse', 'Laptop'],\n    'rating': [5, 4, 4, 5, 3, 5],\n    'reviewer': ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank']\n})\n\nprint(\"Product reviews:\")\nprint(reviews)\nprint()\n\n# Count operations\nprint(\"Number of reviews per product:\")\nprint(reviews.groupby('product').size())\nprint()\n\nprint(\"Average rating per product:\")\nprint(reviews.groupby('product')['rating'].mean())\nprint()\n\nprint(\"Number of unique reviewers per product:\")\nprint(reviews.groupby('product')['reviewer'].nunique())\n",[2086],{"type":393,"tag":423,"props":2087,"children":2088},{"__ignoreMap":6},[2089,2108,2115,2123,2139,2198,2259,2320,2327,2334,2354,2366,2377,2384,2392,2412,2433,2444,2451,2471,2499,2510,2517,2537],{"type":393,"tag":427,"props":2090,"children":2091},{"class":429,"line":11},[2092,2096,2100,2104],{"type":393,"tag":427,"props":2093,"children":2094},{"style":433},[2095],{"type":398,"value":436},{"type":393,"tag":427,"props":2097,"children":2098},{"style":439},[2099],{"type":398,"value":442},{"type":393,"tag":427,"props":2101,"children":2102},{"style":433},[2103],{"type":398,"value":447},{"type":393,"tag":427,"props":2105,"children":2106},{"style":439},[2107],{"type":398,"value":452},{"type":393,"tag":427,"props":2109,"children":2110},{"class":429,"line":27},[2111],{"type":393,"tag":427,"props":2112,"children":2113},{"emptyLinePlaceholder":12},[2114],{"type":398,"value":460},{"type":393,"tag":427,"props":2116,"children":2117},{"class":429,"line":36},[2118],{"type":393,"tag":427,"props":2119,"children":2120},{"style":466},[2121],{"type":398,"value":2122},"# Product reviews\n",{"type":393,"tag":427,"props":2124,"children":2125},{"class":429,"line":45},[2126,2131,2135],{"type":393,"tag":427,"props":2127,"children":2128},{"style":439},[2129],{"type":398,"value":2130},"reviews ",{"type":393,"tag":427,"props":2132,"children":2133},{"style":433},[2134],{"type":398,"value":482},{"type":393,"tag":427,"props":2136,"children":2137},{"style":439},[2138],{"type":398,"value":487},{"type":393,"tag":427,"props":2140,"children":2141},{"class":429,"line":54},[2142,2146,2150,2154,2158,2162,2166,2170,2174,2178,2182,2186,2190,2194],{"type":393,"tag":427,"props":2143,"children":2144},{"style":493},[2145],{"type":398,"value":1055},{"type":393,"tag":427,"props":2147,"children":2148},{"style":439},[2149],{"type":398,"value":501},{"type":393,"tag":427,"props":2151,"children":2152},{"style":493},[2153],{"type":398,"value":1064},{"type":393,"tag":427,"props":2155,"children":2156},{"style":439},[2157],{"type":398,"value":511},{"type":393,"tag":427,"props":2159,"children":2160},{"style":493},[2161],{"type":398,"value":1073},{"type":393,"tag":427,"props":2163,"children":2164},{"style":439},[2165],{"type":398,"value":511},{"type":393,"tag":427,"props":2167,"children":2168},{"style":493},[2169],{"type":398,"value":1064},{"type":393,"tag":427,"props":2171,"children":2172},{"style":439},[2173],{"type":398,"value":511},{"type":393,"tag":427,"props":2175,"children":2176},{"style":493},[2177],{"type":398,"value":1082},{"type":393,"tag":427,"props":2179,"children":2180},{"style":439},[2181],{"type":398,"value":511},{"type":393,"tag":427,"props":2183,"children":2184},{"style":493},[2185],{"type":398,"value":1073},{"type":393,"tag":427,"props":2187,"children":2188},{"style":439},[2189],{"type":398,"value":511},{"type":393,"tag":427,"props":2191,"children":2192},{"style":493},[2193],{"type":398,"value":1064},{"type":393,"tag":427,"props":2195,"children":2196},{"style":439},[2197],{"type":398,"value":546},{"type":393,"tag":427,"props":2199,"children":2200},{"class":429,"line":63},[2201,2206,2210,2214,2218,2223,2227,2231,2235,2239,2243,2247,2251,2255],{"type":393,"tag":427,"props":2202,"children":2203},{"style":493},[2204],{"type":398,"value":2205},"    'rating'",{"type":393,"tag":427,"props":2207,"children":2208},{"style":439},[2209],{"type":398,"value":501},{"type":393,"tag":427,"props":2211,"children":2212},{"style":618},[2213],{"type":398,"value":1809},{"type":393,"tag":427,"props":2215,"children":2216},{"style":439},[2217],{"type":398,"value":511},{"type":393,"tag":427,"props":2219,"children":2220},{"style":618},[2221],{"type":398,"value":2222},"4",{"type":393,"tag":427,"props":2224,"children":2225},{"style":439},[2226],{"type":398,"value":511},{"type":393,"tag":427,"props":2228,"children":2229},{"style":618},[2230],{"type":398,"value":2222},{"type":393,"tag":427,"props":2232,"children":2233},{"style":439},[2234],{"type":398,"value":511},{"type":393,"tag":427,"props":2236,"children":2237},{"style":618},[2238],{"type":398,"value":1809},{"type":393,"tag":427,"props":2240,"children":2241},{"style":439},[2242],{"type":398,"value":511},{"type":393,"tag":427,"props":2244,"children":2245},{"style":618},[2246],{"type":398,"value":1818},{"type":393,"tag":427,"props":2248,"children":2249},{"style":439},[2250],{"type":398,"value":511},{"type":393,"tag":427,"props":2252,"children":2253},{"style":618},[2254],{"type":398,"value":1809},{"type":393,"tag":427,"props":2256,"children":2257},{"style":439},[2258],{"type":398,"value":546},{"type":393,"tag":427,"props":2260,"children":2261},{"class":429,"line":72},[2262,2267,2271,2275,2279,2283,2287,2291,2295,2299,2303,2307,2311,2316],{"type":393,"tag":427,"props":2263,"children":2264},{"style":493},[2265],{"type":398,"value":2266},"    'reviewer'",{"type":393,"tag":427,"props":2268,"children":2269},{"style":439},[2270],{"type":398,"value":501},{"type":393,"tag":427,"props":2272,"children":2273},{"style":493},[2274],{"type":398,"value":563},{"type":393,"tag":427,"props":2276,"children":2277},{"style":439},[2278],{"type":398,"value":511},{"type":393,"tag":427,"props":2280,"children":2281},{"style":493},[2282],{"type":398,"value":572},{"type":393,"tag":427,"props":2284,"children":2285},{"style":439},[2286],{"type":398,"value":511},{"type":393,"tag":427,"props":2288,"children":2289},{"style":493},[2290],{"type":398,"value":581},{"type":393,"tag":427,"props":2292,"children":2293},{"style":439},[2294],{"type":398,"value":511},{"type":393,"tag":427,"props":2296,"children":2297},{"style":493},[2298],{"type":398,"value":590},{"type":393,"tag":427,"props":2300,"children":2301},{"style":439},[2302],{"type":398,"value":511},{"type":393,"tag":427,"props":2304,"children":2305},{"style":493},[2306],{"type":398,"value":599},{"type":393,"tag":427,"props":2308,"children":2309},{"style":439},[2310],{"type":398,"value":511},{"type":393,"tag":427,"props":2312,"children":2313},{"style":493},[2314],{"type":398,"value":2315},"'Frank'",{"type":393,"tag":427,"props":2317,"children":2318},{"style":439},[2319],{"type":398,"value":662},{"type":393,"tag":427,"props":2321,"children":2322},{"class":429,"line":83},[2323],{"type":393,"tag":427,"props":2324,"children":2325},{"style":439},[2326],{"type":398,"value":670},{"type":393,"tag":427,"props":2328,"children":2329},{"class":429,"line":92},[2330],{"type":393,"tag":427,"props":2331,"children":2332},{"emptyLinePlaceholder":12},[2333],{"type":398,"value":460},{"type":393,"tag":427,"props":2335,"children":2336},{"class":429,"line":101},[2337,2341,2345,2350],{"type":393,"tag":427,"props":2338,"children":2339},{"style":618},[2340],{"type":398,"value":685},{"type":393,"tag":427,"props":2342,"children":2343},{"style":439},[2344],{"type":398,"value":690},{"type":393,"tag":427,"props":2346,"children":2347},{"style":493},[2348],{"type":398,"value":2349},"\"Product reviews:\"",{"type":393,"tag":427,"props":2351,"children":2352},{"style":439},[2353],{"type":398,"value":700},{"type":393,"tag":427,"props":2355,"children":2356},{"class":429,"line":110},[2357,2361],{"type":393,"tag":427,"props":2358,"children":2359},{"style":618},[2360],{"type":398,"value":685},{"type":393,"tag":427,"props":2362,"children":2363},{"style":439},[2364],{"type":398,"value":2365},"(reviews)\n",{"type":393,"tag":427,"props":2367,"children":2368},{"class":429,"line":121},[2369,2373],{"type":393,"tag":427,"props":2370,"children":2371},{"style":618},[2372],{"type":398,"value":685},{"type":393,"tag":427,"props":2374,"children":2375},{"style":439},[2376],{"type":398,"value":724},{"type":393,"tag":427,"props":2378,"children":2379},{"class":429,"line":130},[2380],{"type":393,"tag":427,"props":2381,"children":2382},{"emptyLinePlaceholder":12},[2383],{"type":398,"value":460},{"type":393,"tag":427,"props":2385,"children":2386},{"class":429,"line":139},[2387],{"type":393,"tag":427,"props":2388,"children":2389},{"style":466},[2390],{"type":398,"value":2391},"# Count operations\n",{"type":393,"tag":427,"props":2393,"children":2394},{"class":429,"line":148},[2395,2399,2403,2408],{"type":393,"tag":427,"props":2396,"children":2397},{"style":618},[2398],{"type":398,"value":685},{"type":393,"tag":427,"props":2400,"children":2401},{"style":439},[2402],{"type":398,"value":690},{"type":393,"tag":427,"props":2404,"children":2405},{"style":493},[2406],{"type":398,"value":2407},"\"Number of reviews per product:\"",{"type":393,"tag":427,"props":2409,"children":2410},{"style":439},[2411],{"type":398,"value":700},{"type":393,"tag":427,"props":2413,"children":2414},{"class":429,"line":159},[2415,2419,2424,2429],{"type":393,"tag":427,"props":2416,"children":2417},{"style":618},[2418],{"type":398,"value":685},{"type":393,"tag":427,"props":2420,"children":2421},{"style":439},[2422],{"type":398,"value":2423},"(reviews.groupby(",{"type":393,"tag":427,"props":2425,"children":2426},{"style":493},[2427],{"type":398,"value":2428},"'product'",{"type":393,"tag":427,"props":2430,"children":2431},{"style":439},[2432],{"type":398,"value":1406},{"type":393,"tag":427,"props":2434,"children":2435},{"class":429,"line":168},[2436,2440],{"type":393,"tag":427,"props":2437,"children":2438},{"style":618},[2439],{"type":398,"value":685},{"type":393,"tag":427,"props":2441,"children":2442},{"style":439},[2443],{"type":398,"value":724},{"type":393,"tag":427,"props":2445,"children":2446},{"class":429,"line":177},[2447],{"type":393,"tag":427,"props":2448,"children":2449},{"emptyLinePlaceholder":12},[2450],{"type":398,"value":460},{"type":393,"tag":427,"props":2452,"children":2453},{"class":429,"line":186},[2454,2458,2462,2467],{"type":393,"tag":427,"props":2455,"children":2456},{"style":618},[2457],{"type":398,"value":685},{"type":393,"tag":427,"props":2459,"children":2460},{"style":439},[2461],{"type":398,"value":690},{"type":393,"tag":427,"props":2463,"children":2464},{"style":493},[2465],{"type":398,"value":2466},"\"Average rating per product:\"",{"type":393,"tag":427,"props":2468,"children":2469},{"style":439},[2470],{"type":398,"value":700},{"type":393,"tag":427,"props":2472,"children":2473},{"class":429,"line":197},[2474,2478,2482,2486,2490,2495],{"type":393,"tag":427,"props":2475,"children":2476},{"style":618},[2477],{"type":398,"value":685},{"type":393,"tag":427,"props":2479,"children":2480},{"style":439},[2481],{"type":398,"value":2423},{"type":393,"tag":427,"props":2483,"children":2484},{"style":493},[2485],{"type":398,"value":2428},{"type":393,"tag":427,"props":2487,"children":2488},{"style":439},[2489],{"type":398,"value":766},{"type":393,"tag":427,"props":2491,"children":2492},{"style":493},[2493],{"type":398,"value":2494},"'rating'",{"type":393,"tag":427,"props":2496,"children":2497},{"style":439},[2498],{"type":398,"value":1348},{"type":393,"tag":427,"props":2500,"children":2501},{"class":429,"line":206},[2502,2506],{"type":393,"tag":427,"props":2503,"children":2504},{"style":618},[2505],{"type":398,"value":685},{"type":393,"tag":427,"props":2507,"children":2508},{"style":439},[2509],{"type":398,"value":724},{"type":393,"tag":427,"props":2511,"children":2512},{"class":429,"line":215},[2513],{"type":393,"tag":427,"props":2514,"children":2515},{"emptyLinePlaceholder":12},[2516],{"type":398,"value":460},{"type":393,"tag":427,"props":2518,"children":2519},{"class":429,"line":224},[2520,2524,2528,2533],{"type":393,"tag":427,"props":2521,"children":2522},{"style":618},[2523],{"type":398,"value":685},{"type":393,"tag":427,"props":2525,"children":2526},{"style":439},[2527],{"type":398,"value":690},{"type":393,"tag":427,"props":2529,"children":2530},{"style":493},[2531],{"type":398,"value":2532},"\"Number of unique reviewers per product:\"",{"type":393,"tag":427,"props":2534,"children":2535},{"style":439},[2536],{"type":398,"value":700},{"type":393,"tag":427,"props":2538,"children":2539},{"class":429,"line":233},[2540,2544,2548,2552,2556,2561],{"type":393,"tag":427,"props":2541,"children":2542},{"style":618},[2543],{"type":398,"value":685},{"type":393,"tag":427,"props":2545,"children":2546},{"style":439},[2547],{"type":398,"value":2423},{"type":393,"tag":427,"props":2549,"children":2550},{"style":493},[2551],{"type":398,"value":2428},{"type":393,"tag":427,"props":2553,"children":2554},{"style":439},[2555],{"type":398,"value":766},{"type":393,"tag":427,"props":2557,"children":2558},{"style":493},[2559],{"type":398,"value":2560},"'reviewer'",{"type":393,"tag":427,"props":2562,"children":2563},{"style":439},[2564],{"type":398,"value":2565},"].nunique())\n",{"type":393,"tag":810,"props":2567,"children":2569},{"id":2568},"grouping-by-multiple-columns",[2570],{"type":398,"value":2571},"🎨 Grouping by Multiple Columns",{"type":393,"tag":401,"props":2573,"children":2574},{},[2575],{"type":398,"value":2576},"You can group by multiple columns to create more detailed analysis:",{"type":393,"tag":412,"props":2578,"children":2579},{},[2580],{"type":393,"tag":416,"props":2581,"children":2583},{"className":418,"code":2582,"language":420,"meta":6,"style":6},"import pandas as pd\n\n# Sales by region and quarter\nsales = pd.DataFrame({\n    'region': ['North', 'South', 'North', 'South', 'North', 'South'],\n    'quarter': ['Q1', 'Q1', 'Q2', 'Q2', 'Q1', 'Q2'],\n    'sales': [100000, 85000, 110000, 90000, 95000, 88000]\n})\n\nprint(\"Sales data:\")\nprint(sales)\nprint()\n\n# Group by multiple columns\nmulti_group = sales.groupby(['region', 'quarter'])['sales'].sum()\nprint(\"Sales by region and quarter:\")\nprint(multi_group)\n",[2584],{"type":393,"tag":423,"props":2585,"children":2586},{"__ignoreMap":6},[2587,2606,2613,2621,2636,2698,2760,2826,2833,2840,2859,2870,2881,2888,2896,2941,2961],{"type":393,"tag":427,"props":2588,"children":2589},{"class":429,"line":11},[2590,2594,2598,2602],{"type":393,"tag":427,"props":2591,"children":2592},{"style":433},[2593],{"type":398,"value":436},{"type":393,"tag":427,"props":2595,"children":2596},{"style":439},[2597],{"type":398,"value":442},{"type":393,"tag":427,"props":2599,"children":2600},{"style":433},[2601],{"type":398,"value":447},{"type":393,"tag":427,"props":2603,"children":2604},{"style":439},[2605],{"type":398,"value":452},{"type":393,"tag":427,"props":2607,"children":2608},{"class":429,"line":27},[2609],{"type":393,"tag":427,"props":2610,"children":2611},{"emptyLinePlaceholder":12},[2612],{"type":398,"value":460},{"type":393,"tag":427,"props":2614,"children":2615},{"class":429,"line":36},[2616],{"type":393,"tag":427,"props":2617,"children":2618},{"style":466},[2619],{"type":398,"value":2620},"# Sales by region and quarter\n",{"type":393,"tag":427,"props":2622,"children":2623},{"class":429,"line":45},[2624,2628,2632],{"type":393,"tag":427,"props":2625,"children":2626},{"style":439},[2627],{"type":398,"value":477},{"type":393,"tag":427,"props":2629,"children":2630},{"style":433},[2631],{"type":398,"value":482},{"type":393,"tag":427,"props":2633,"children":2634},{"style":439},[2635],{"type":398,"value":487},{"type":393,"tag":427,"props":2637,"children":2638},{"class":429,"line":54},[2639,2644,2648,2653,2657,2662,2666,2670,2674,2678,2682,2686,2690,2694],{"type":393,"tag":427,"props":2640,"children":2641},{"style":493},[2642],{"type":398,"value":2643},"    'region'",{"type":393,"tag":427,"props":2645,"children":2646},{"style":439},[2647],{"type":398,"value":501},{"type":393,"tag":427,"props":2649,"children":2650},{"style":493},[2651],{"type":398,"value":2652},"'North'",{"type":393,"tag":427,"props":2654,"children":2655},{"style":439},[2656],{"type":398,"value":511},{"type":393,"tag":427,"props":2658,"children":2659},{"style":493},[2660],{"type":398,"value":2661},"'South'",{"type":393,"tag":427,"props":2663,"children":2664},{"style":439},[2665],{"type":398,"value":511},{"type":393,"tag":427,"props":2667,"children":2668},{"style":493},[2669],{"type":398,"value":2652},{"type":393,"tag":427,"props":2671,"children":2672},{"style":439},[2673],{"type":398,"value":511},{"type":393,"tag":427,"props":2675,"children":2676},{"style":493},[2677],{"type":398,"value":2661},{"type":393,"tag":427,"props":2679,"children":2680},{"style":439},[2681],{"type":398,"value":511},{"type":393,"tag":427,"props":2683,"children":2684},{"style":493},[2685],{"type":398,"value":2652},{"type":393,"tag":427,"props":2687,"children":2688},{"style":439},[2689],{"type":398,"value":511},{"type":393,"tag":427,"props":2691,"children":2692},{"style":493},[2693],{"type":398,"value":2661},{"type":393,"tag":427,"props":2695,"children":2696},{"style":439},[2697],{"type":398,"value":546},{"type":393,"tag":427,"props":2699,"children":2700},{"class":429,"line":63},[2701,2706,2710,2715,2719,2723,2727,2732,2736,2740,2744,2748,2752,2756],{"type":393,"tag":427,"props":2702,"children":2703},{"style":493},[2704],{"type":398,"value":2705},"    'quarter'",{"type":393,"tag":427,"props":2707,"children":2708},{"style":439},[2709],{"type":398,"value":501},{"type":393,"tag":427,"props":2711,"children":2712},{"style":493},[2713],{"type":398,"value":2714},"'Q1'",{"type":393,"tag":427,"props":2716,"children":2717},{"style":439},[2718],{"type":398,"value":511},{"type":393,"tag":427,"props":2720,"children":2721},{"style":493},[2722],{"type":398,"value":2714},{"type":393,"tag":427,"props":2724,"children":2725},{"style":439},[2726],{"type":398,"value":511},{"type":393,"tag":427,"props":2728,"children":2729},{"style":493},[2730],{"type":398,"value":2731},"'Q2'",{"type":393,"tag":427,"props":2733,"children":2734},{"style":439},[2735],{"type":398,"value":511},{"type":393,"tag":427,"props":2737,"children":2738},{"style":493},[2739],{"type":398,"value":2731},{"type":393,"tag":427,"props":2741,"children":2742},{"style":439},[2743],{"type":398,"value":511},{"type":393,"tag":427,"props":2745,"children":2746},{"style":493},[2747],{"type":398,"value":2714},{"type":393,"tag":427,"props":2749,"children":2750},{"style":439},[2751],{"type":398,"value":511},{"type":393,"tag":427,"props":2753,"children":2754},{"style":493},[2755],{"type":398,"value":2731},{"type":393,"tag":427,"props":2757,"children":2758},{"style":439},[2759],{"type":398,"value":546},{"type":393,"tag":427,"props":2761,"children":2762},{"class":429,"line":72},[2763,2768,2772,2777,2781,2786,2790,2795,2799,2804,2808,2813,2817,2822],{"type":393,"tag":427,"props":2764,"children":2765},{"style":493},[2766],{"type":398,"value":2767},"    'sales'",{"type":393,"tag":427,"props":2769,"children":2770},{"style":439},[2771],{"type":398,"value":501},{"type":393,"tag":427,"props":2773,"children":2774},{"style":618},[2775],{"type":398,"value":2776},"100000",{"type":393,"tag":427,"props":2778,"children":2779},{"style":439},[2780],{"type":398,"value":511},{"type":393,"tag":427,"props":2782,"children":2783},{"style":618},[2784],{"type":398,"value":2785},"85000",{"type":393,"tag":427,"props":2787,"children":2788},{"style":439},[2789],{"type":398,"value":511},{"type":393,"tag":427,"props":2791,"children":2792},{"style":618},[2793],{"type":398,"value":2794},"110000",{"type":393,"tag":427,"props":2796,"children":2797},{"style":439},[2798],{"type":398,"value":511},{"type":393,"tag":427,"props":2800,"children":2801},{"style":618},[2802],{"type":398,"value":2803},"90000",{"type":393,"tag":427,"props":2805,"children":2806},{"style":439},[2807],{"type":398,"value":511},{"type":393,"tag":427,"props":2809,"children":2810},{"style":618},[2811],{"type":398,"value":2812},"95000",{"type":393,"tag":427,"props":2814,"children":2815},{"style":439},[2816],{"type":398,"value":511},{"type":393,"tag":427,"props":2818,"children":2819},{"style":618},[2820],{"type":398,"value":2821},"88000",{"type":393,"tag":427,"props":2823,"children":2824},{"style":439},[2825],{"type":398,"value":662},{"type":393,"tag":427,"props":2827,"children":2828},{"class":429,"line":83},[2829],{"type":393,"tag":427,"props":2830,"children":2831},{"style":439},[2832],{"type":398,"value":670},{"type":393,"tag":427,"props":2834,"children":2835},{"class":429,"line":92},[2836],{"type":393,"tag":427,"props":2837,"children":2838},{"emptyLinePlaceholder":12},[2839],{"type":398,"value":460},{"type":393,"tag":427,"props":2841,"children":2842},{"class":429,"line":101},[2843,2847,2851,2855],{"type":393,"tag":427,"props":2844,"children":2845},{"style":618},[2846],{"type":398,"value":685},{"type":393,"tag":427,"props":2848,"children":2849},{"style":439},[2850],{"type":398,"value":690},{"type":393,"tag":427,"props":2852,"children":2853},{"style":493},[2854],{"type":398,"value":695},{"type":393,"tag":427,"props":2856,"children":2857},{"style":439},[2858],{"type":398,"value":700},{"type":393,"tag":427,"props":2860,"children":2861},{"class":429,"line":110},[2862,2866],{"type":393,"tag":427,"props":2863,"children":2864},{"style":618},[2865],{"type":398,"value":685},{"type":393,"tag":427,"props":2867,"children":2868},{"style":439},[2869],{"type":398,"value":712},{"type":393,"tag":427,"props":2871,"children":2872},{"class":429,"line":121},[2873,2877],{"type":393,"tag":427,"props":2874,"children":2875},{"style":618},[2876],{"type":398,"value":685},{"type":393,"tag":427,"props":2878,"children":2879},{"style":439},[2880],{"type":398,"value":724},{"type":393,"tag":427,"props":2882,"children":2883},{"class":429,"line":130},[2884],{"type":393,"tag":427,"props":2885,"children":2886},{"emptyLinePlaceholder":12},[2887],{"type":398,"value":460},{"type":393,"tag":427,"props":2889,"children":2890},{"class":429,"line":139},[2891],{"type":393,"tag":427,"props":2892,"children":2893},{"style":466},[2894],{"type":398,"value":2895},"# Group by multiple columns\n",{"type":393,"tag":427,"props":2897,"children":2898},{"class":429,"line":148},[2899,2904,2908,2913,2918,2922,2927,2932,2937],{"type":393,"tag":427,"props":2900,"children":2901},{"style":439},[2902],{"type":398,"value":2903},"multi_group ",{"type":393,"tag":427,"props":2905,"children":2906},{"style":433},[2907],{"type":398,"value":482},{"type":393,"tag":427,"props":2909,"children":2910},{"style":439},[2911],{"type":398,"value":2912}," sales.groupby([",{"type":393,"tag":427,"props":2914,"children":2915},{"style":493},[2916],{"type":398,"value":2917},"'region'",{"type":393,"tag":427,"props":2919,"children":2920},{"style":439},[2921],{"type":398,"value":511},{"type":393,"tag":427,"props":2923,"children":2924},{"style":493},[2925],{"type":398,"value":2926},"'quarter'",{"type":393,"tag":427,"props":2928,"children":2929},{"style":439},[2930],{"type":398,"value":2931},"])[",{"type":393,"tag":427,"props":2933,"children":2934},{"style":493},[2935],{"type":398,"value":2936},"'sales'",{"type":393,"tag":427,"props":2938,"children":2939},{"style":439},[2940],{"type":398,"value":776},{"type":393,"tag":427,"props":2942,"children":2943},{"class":429,"line":159},[2944,2948,2952,2957],{"type":393,"tag":427,"props":2945,"children":2946},{"style":618},[2947],{"type":398,"value":685},{"type":393,"tag":427,"props":2949,"children":2950},{"style":439},[2951],{"type":398,"value":690},{"type":393,"tag":427,"props":2953,"children":2954},{"style":493},[2955],{"type":398,"value":2956},"\"Sales by region and quarter:\"",{"type":393,"tag":427,"props":2958,"children":2959},{"style":439},[2960],{"type":398,"value":700},{"type":393,"tag":427,"props":2962,"children":2963},{"class":429,"line":168},[2964,2968],{"type":393,"tag":427,"props":2965,"children":2966},{"style":618},[2967],{"type":398,"value":685},{"type":393,"tag":427,"props":2969,"children":2970},{"style":439},[2971],{"type":398,"value":2972},"(multi_group)\n",{"type":393,"tag":810,"props":2974,"children":2976},{"id":2975},"multiple-aggregations-with-agg",[2977],{"type":398,"value":2978},"🔧 Multiple Aggregations with agg()",{"type":393,"tag":401,"props":2980,"children":2981},{},[2982,2984,2990],{"type":398,"value":2983},"The ",{"type":393,"tag":423,"props":2985,"children":2987},{"className":2986},[],[2988],{"type":398,"value":2989},".agg()",{"type":398,"value":2991}," method lets you apply multiple functions at once:",{"type":393,"tag":822,"props":2993,"children":2996},{"emoji":2994,"title":2995,"type":826},"🔧","Using .agg() for Multiple Functions",[2997,3005,3041,3049],{"type":393,"tag":401,"props":2998,"children":2999},{},[3000],{"type":393,"tag":832,"props":3001,"children":3002},{},[3003],{"type":398,"value":3004},"Syntax Options:",{"type":393,"tag":838,"props":3006,"children":3007},{},[3008,3019,3030],{"type":393,"tag":842,"props":3009,"children":3010},{},[3011,3017],{"type":393,"tag":423,"props":3012,"children":3014},{"className":3013},[],[3015],{"type":398,"value":3016},".agg(['sum', 'mean'])",{"type":398,"value":3018}," - Multiple functions on one column",{"type":393,"tag":842,"props":3020,"children":3021},{},[3022,3028],{"type":393,"tag":423,"props":3023,"children":3025},{"className":3024},[],[3026],{"type":398,"value":3027},".agg({'col1': 'sum', 'col2': 'mean'})",{"type":398,"value":3029}," - Different functions per column",{"type":393,"tag":842,"props":3031,"children":3032},{},[3033,3039],{"type":393,"tag":423,"props":3034,"children":3036},{"className":3035},[],[3037],{"type":398,"value":3038},".agg({'col': ['sum', 'mean', 'count']})",{"type":398,"value":3040}," - Multiple functions per column",{"type":393,"tag":401,"props":3042,"children":3043},{},[3044],{"type":393,"tag":832,"props":3045,"children":3046},{},[3047],{"type":398,"value":3048},"Benefits:",{"type":393,"tag":838,"props":3050,"children":3051},{},[3052,3057,3062],{"type":393,"tag":842,"props":3053,"children":3054},{},[3055],{"type":398,"value":3056},"Get multiple statistics in one operation",{"type":393,"tag":842,"props":3058,"children":3059},{},[3060],{"type":398,"value":3061},"More efficient than separate GroupBy calls",{"type":393,"tag":842,"props":3063,"children":3064},{},[3065],{"type":398,"value":3066},"Clean, organized output",{"type":393,"tag":412,"props":3068,"children":3069},{},[3070],{"type":393,"tag":416,"props":3071,"children":3073},{"className":418,"code":3072,"language":420,"meta":6,"style":6},"import pandas as pd\n\n# Store performance data\nstores = pd.DataFrame({\n    'region': ['East', 'West', 'East', 'West', 'East'],\n    'revenue': [50000, 75000, 45000, 80000, 55000],\n    'customers': [150, 200, 120, 220, 160]\n})\n\nprint(\"Store data:\")\nprint(stores)\nprint()\n\n# Multiple aggregations\nsummary = stores.groupby('region').agg({\n    'revenue': ['sum', 'mean'],\n    'customers': ['sum', 'mean']\n})\nprint(\"Store summary by region:\")\nprint(summary)\n",[3074],{"type":393,"tag":423,"props":3075,"children":3076},{"__ignoreMap":6},[3077,3096,3103,3111,3127,3180,3232,3289,3296,3303,3323,3335,3346,3353,3361,3387,3416,3443,3450,3470],{"type":393,"tag":427,"props":3078,"children":3079},{"class":429,"line":11},[3080,3084,3088,3092],{"type":393,"tag":427,"props":3081,"children":3082},{"style":433},[3083],{"type":398,"value":436},{"type":393,"tag":427,"props":3085,"children":3086},{"style":439},[3087],{"type":398,"value":442},{"type":393,"tag":427,"props":3089,"children":3090},{"style":433},[3091],{"type":398,"value":447},{"type":393,"tag":427,"props":3093,"children":3094},{"style":439},[3095],{"type":398,"value":452},{"type":393,"tag":427,"props":3097,"children":3098},{"class":429,"line":27},[3099],{"type":393,"tag":427,"props":3100,"children":3101},{"emptyLinePlaceholder":12},[3102],{"type":398,"value":460},{"type":393,"tag":427,"props":3104,"children":3105},{"class":429,"line":36},[3106],{"type":393,"tag":427,"props":3107,"children":3108},{"style":466},[3109],{"type":398,"value":3110},"# Store performance data\n",{"type":393,"tag":427,"props":3112,"children":3113},{"class":429,"line":45},[3114,3119,3123],{"type":393,"tag":427,"props":3115,"children":3116},{"style":439},[3117],{"type":398,"value":3118},"stores ",{"type":393,"tag":427,"props":3120,"children":3121},{"style":433},[3122],{"type":398,"value":482},{"type":393,"tag":427,"props":3124,"children":3125},{"style":439},[3126],{"type":398,"value":487},{"type":393,"tag":427,"props":3128,"children":3129},{"class":429,"line":54},[3130,3134,3138,3143,3147,3152,3156,3160,3164,3168,3172,3176],{"type":393,"tag":427,"props":3131,"children":3132},{"style":493},[3133],{"type":398,"value":2643},{"type":393,"tag":427,"props":3135,"children":3136},{"style":439},[3137],{"type":398,"value":501},{"type":393,"tag":427,"props":3139,"children":3140},{"style":493},[3141],{"type":398,"value":3142},"'East'",{"type":393,"tag":427,"props":3144,"children":3145},{"style":439},[3146],{"type":398,"value":511},{"type":393,"tag":427,"props":3148,"children":3149},{"style":493},[3150],{"type":398,"value":3151},"'West'",{"type":393,"tag":427,"props":3153,"children":3154},{"style":439},[3155],{"type":398,"value":511},{"type":393,"tag":427,"props":3157,"children":3158},{"style":493},[3159],{"type":398,"value":3142},{"type":393,"tag":427,"props":3161,"children":3162},{"style":439},[3163],{"type":398,"value":511},{"type":393,"tag":427,"props":3165,"children":3166},{"style":493},[3167],{"type":398,"value":3151},{"type":393,"tag":427,"props":3169,"children":3170},{"style":439},[3171],{"type":398,"value":511},{"type":393,"tag":427,"props":3173,"children":3174},{"style":493},[3175],{"type":398,"value":3142},{"type":393,"tag":427,"props":3177,"children":3178},{"style":439},[3179],{"type":398,"value":546},{"type":393,"tag":427,"props":3181,"children":3182},{"class":429,"line":63},[3183,3187,3191,3195,3199,3203,3207,3211,3215,3219,3223,3228],{"type":393,"tag":427,"props":3184,"children":3185},{"style":493},[3186],{"type":398,"value":611},{"type":393,"tag":427,"props":3188,"children":3189},{"style":439},[3190],{"type":398,"value":501},{"type":393,"tag":427,"props":3192,"children":3193},{"style":618},[3194],{"type":398,"value":621},{"type":393,"tag":427,"props":3196,"children":3197},{"style":439},[3198],{"type":398,"value":511},{"type":393,"tag":427,"props":3200,"children":3201},{"style":618},[3202],{"type":398,"value":630},{"type":393,"tag":427,"props":3204,"children":3205},{"style":439},[3206],{"type":398,"value":511},{"type":393,"tag":427,"props":3208,"children":3209},{"style":618},[3210],{"type":398,"value":639},{"type":393,"tag":427,"props":3212,"children":3213},{"style":439},[3214],{"type":398,"value":511},{"type":393,"tag":427,"props":3216,"children":3217},{"style":618},[3218],{"type":398,"value":657},{"type":393,"tag":427,"props":3220,"children":3221},{"style":439},[3222],{"type":398,"value":511},{"type":393,"tag":427,"props":3224,"children":3225},{"style":618},[3226],{"type":398,"value":3227},"55000",{"type":393,"tag":427,"props":3229,"children":3230},{"style":439},[3231],{"type":398,"value":546},{"type":393,"tag":427,"props":3233,"children":3234},{"class":429,"line":72},[3235,3240,3244,3249,3253,3258,3262,3267,3271,3276,3280,3285],{"type":393,"tag":427,"props":3236,"children":3237},{"style":493},[3238],{"type":398,"value":3239},"    'customers'",{"type":393,"tag":427,"props":3241,"children":3242},{"style":439},[3243],{"type":398,"value":501},{"type":393,"tag":427,"props":3245,"children":3246},{"style":618},[3247],{"type":398,"value":3248},"150",{"type":393,"tag":427,"props":3250,"children":3251},{"style":439},[3252],{"type":398,"value":511},{"type":393,"tag":427,"props":3254,"children":3255},{"style":618},[3256],{"type":398,"value":3257},"200",{"type":393,"tag":427,"props":3259,"children":3260},{"style":439},[3261],{"type":398,"value":511},{"type":393,"tag":427,"props":3263,"children":3264},{"style":618},[3265],{"type":398,"value":3266},"120",{"type":393,"tag":427,"props":3268,"children":3269},{"style":439},[3270],{"type":398,"value":511},{"type":393,"tag":427,"props":3272,"children":3273},{"style":618},[3274],{"type":398,"value":3275},"220",{"type":393,"tag":427,"props":3277,"children":3278},{"style":439},[3279],{"type":398,"value":511},{"type":393,"tag":427,"props":3281,"children":3282},{"style":618},[3283],{"type":398,"value":3284},"160",{"type":393,"tag":427,"props":3286,"children":3287},{"style":439},[3288],{"type":398,"value":662},{"type":393,"tag":427,"props":3290,"children":3291},{"class":429,"line":83},[3292],{"type":393,"tag":427,"props":3293,"children":3294},{"style":439},[3295],{"type":398,"value":670},{"type":393,"tag":427,"props":3297,"children":3298},{"class":429,"line":92},[3299],{"type":393,"tag":427,"props":3300,"children":3301},{"emptyLinePlaceholder":12},[3302],{"type":398,"value":460},{"type":393,"tag":427,"props":3304,"children":3305},{"class":429,"line":101},[3306,3310,3314,3319],{"type":393,"tag":427,"props":3307,"children":3308},{"style":618},[3309],{"type":398,"value":685},{"type":393,"tag":427,"props":3311,"children":3312},{"style":439},[3313],{"type":398,"value":690},{"type":393,"tag":427,"props":3315,"children":3316},{"style":493},[3317],{"type":398,"value":3318},"\"Store data:\"",{"type":393,"tag":427,"props":3320,"children":3321},{"style":439},[3322],{"type":398,"value":700},{"type":393,"tag":427,"props":3324,"children":3325},{"class":429,"line":110},[3326,3330],{"type":393,"tag":427,"props":3327,"children":3328},{"style":618},[3329],{"type":398,"value":685},{"type":393,"tag":427,"props":3331,"children":3332},{"style":439},[3333],{"type":398,"value":3334},"(stores)\n",{"type":393,"tag":427,"props":3336,"children":3337},{"class":429,"line":121},[3338,3342],{"type":393,"tag":427,"props":3339,"children":3340},{"style":618},[3341],{"type":398,"value":685},{"type":393,"tag":427,"props":3343,"children":3344},{"style":439},[3345],{"type":398,"value":724},{"type":393,"tag":427,"props":3347,"children":3348},{"class":429,"line":130},[3349],{"type":393,"tag":427,"props":3350,"children":3351},{"emptyLinePlaceholder":12},[3352],{"type":398,"value":460},{"type":393,"tag":427,"props":3354,"children":3355},{"class":429,"line":139},[3356],{"type":393,"tag":427,"props":3357,"children":3358},{"style":466},[3359],{"type":398,"value":3360},"# Multiple aggregations\n",{"type":393,"tag":427,"props":3362,"children":3363},{"class":429,"line":148},[3364,3369,3373,3378,3382],{"type":393,"tag":427,"props":3365,"children":3366},{"style":439},[3367],{"type":398,"value":3368},"summary ",{"type":393,"tag":427,"props":3370,"children":3371},{"style":433},[3372],{"type":398,"value":482},{"type":393,"tag":427,"props":3374,"children":3375},{"style":439},[3376],{"type":398,"value":3377}," stores.groupby(",{"type":393,"tag":427,"props":3379,"children":3380},{"style":493},[3381],{"type":398,"value":2917},{"type":393,"tag":427,"props":3383,"children":3384},{"style":439},[3385],{"type":398,"value":3386},").agg({\n",{"type":393,"tag":427,"props":3388,"children":3389},{"class":429,"line":159},[3390,3394,3398,3403,3407,3412],{"type":393,"tag":427,"props":3391,"children":3392},{"style":493},[3393],{"type":398,"value":611},{"type":393,"tag":427,"props":3395,"children":3396},{"style":439},[3397],{"type":398,"value":501},{"type":393,"tag":427,"props":3399,"children":3400},{"style":493},[3401],{"type":398,"value":3402},"'sum'",{"type":393,"tag":427,"props":3404,"children":3405},{"style":439},[3406],{"type":398,"value":511},{"type":393,"tag":427,"props":3408,"children":3409},{"style":493},[3410],{"type":398,"value":3411},"'mean'",{"type":393,"tag":427,"props":3413,"children":3414},{"style":439},[3415],{"type":398,"value":546},{"type":393,"tag":427,"props":3417,"children":3418},{"class":429,"line":168},[3419,3423,3427,3431,3435,3439],{"type":393,"tag":427,"props":3420,"children":3421},{"style":493},[3422],{"type":398,"value":3239},{"type":393,"tag":427,"props":3424,"children":3425},{"style":439},[3426],{"type":398,"value":501},{"type":393,"tag":427,"props":3428,"children":3429},{"style":493},[3430],{"type":398,"value":3402},{"type":393,"tag":427,"props":3432,"children":3433},{"style":439},[3434],{"type":398,"value":511},{"type":393,"tag":427,"props":3436,"children":3437},{"style":493},[3438],{"type":398,"value":3411},{"type":393,"tag":427,"props":3440,"children":3441},{"style":439},[3442],{"type":398,"value":662},{"type":393,"tag":427,"props":3444,"children":3445},{"class":429,"line":177},[3446],{"type":393,"tag":427,"props":3447,"children":3448},{"style":439},[3449],{"type":398,"value":670},{"type":393,"tag":427,"props":3451,"children":3452},{"class":429,"line":186},[3453,3457,3461,3466],{"type":393,"tag":427,"props":3454,"children":3455},{"style":618},[3456],{"type":398,"value":685},{"type":393,"tag":427,"props":3458,"children":3459},{"style":439},[3460],{"type":398,"value":690},{"type":393,"tag":427,"props":3462,"children":3463},{"style":493},[3464],{"type":398,"value":3465},"\"Store summary by region:\"",{"type":393,"tag":427,"props":3467,"children":3468},{"style":439},[3469],{"type":398,"value":700},{"type":393,"tag":427,"props":3471,"children":3472},{"class":429,"line":197},[3473,3477],{"type":393,"tag":427,"props":3474,"children":3475},{"style":618},[3476],{"type":398,"value":685},{"type":393,"tag":427,"props":3478,"children":3479},{"style":439},[3480],{"type":398,"value":3481},"(summary)\n",{"type":393,"tag":810,"props":3483,"children":3485},{"id":3484},"working-with-groupby-results",[3486],{"type":398,"value":3487},"📋 Working with GroupBy Results",{"type":393,"tag":401,"props":3489,"children":3490},{},[3491],{"type":398,"value":3492},"GroupBy results can be converted back to DataFrames for further analysis:",{"type":393,"tag":412,"props":3494,"children":3495},{},[3496],{"type":393,"tag":416,"props":3497,"children":3499},{"className":418,"code":3498,"language":420,"meta":6,"style":6},"import pandas as pd\n\n# Product categories\nproducts = pd.DataFrame({\n    'category': ['Electronics', 'Books', 'Electronics', 'Clothing', 'Books'],\n    'price': [299, 15, 199, 45, 25],\n    'rating': [4.5, 4.0, 4.2, 3.8, 4.1]\n})\n\nprint(\"Product data:\")\nprint(products)\nprint()\n\n# GroupBy with reset_index to get DataFrame\ncategory_stats = products.groupby('category').agg({\n    'price': 'mean',\n    'rating': 'mean'\n}).reset_index()\n\nprint(\"Category statistics (as DataFrame):\")\nprint(category_stats)\nprint()\n\n# Add descriptive column names\ncategory_stats.columns = ['Category', 'Average Price', 'Average Rating']\nprint(\"With better column names:\")\nprint(category_stats)\n",[3500],{"type":393,"tag":423,"props":3501,"children":3502},{"__ignoreMap":6},[3503,3522,3529,3537,3553,3608,3664,3720,3727,3734,3754,3766,3777,3784,3792,3818,3839,3855,3863,3870,3890,3902,3913,3920,3928,3972,3992],{"type":393,"tag":427,"props":3504,"children":3505},{"class":429,"line":11},[3506,3510,3514,3518],{"type":393,"tag":427,"props":3507,"children":3508},{"style":433},[3509],{"type":398,"value":436},{"type":393,"tag":427,"props":3511,"children":3512},{"style":439},[3513],{"type":398,"value":442},{"type":393,"tag":427,"props":3515,"children":3516},{"style":433},[3517],{"type":398,"value":447},{"type":393,"tag":427,"props":3519,"children":3520},{"style":439},[3521],{"type":398,"value":452},{"type":393,"tag":427,"props":3523,"children":3524},{"class":429,"line":27},[3525],{"type":393,"tag":427,"props":3526,"children":3527},{"emptyLinePlaceholder":12},[3528],{"type":398,"value":460},{"type":393,"tag":427,"props":3530,"children":3531},{"class":429,"line":36},[3532],{"type":393,"tag":427,"props":3533,"children":3534},{"style":466},[3535],{"type":398,"value":3536},"# Product categories\n",{"type":393,"tag":427,"props":3538,"children":3539},{"class":429,"line":45},[3540,3545,3549],{"type":393,"tag":427,"props":3541,"children":3542},{"style":439},[3543],{"type":398,"value":3544},"products ",{"type":393,"tag":427,"props":3546,"children":3547},{"style":433},[3548],{"type":398,"value":482},{"type":393,"tag":427,"props":3550,"children":3551},{"style":439},[3552],{"type":398,"value":487},{"type":393,"tag":427,"props":3554,"children":3555},{"class":429,"line":54},[3556,3561,3565,3570,3574,3579,3583,3587,3591,3596,3600,3604],{"type":393,"tag":427,"props":3557,"children":3558},{"style":493},[3559],{"type":398,"value":3560},"    'category'",{"type":393,"tag":427,"props":3562,"children":3563},{"style":439},[3564],{"type":398,"value":501},{"type":393,"tag":427,"props":3566,"children":3567},{"style":493},[3568],{"type":398,"value":3569},"'Electronics'",{"type":393,"tag":427,"props":3571,"children":3572},{"style":439},[3573],{"type":398,"value":511},{"type":393,"tag":427,"props":3575,"children":3576},{"style":493},[3577],{"type":398,"value":3578},"'Books'",{"type":393,"tag":427,"props":3580,"children":3581},{"style":439},[3582],{"type":398,"value":511},{"type":393,"tag":427,"props":3584,"children":3585},{"style":493},[3586],{"type":398,"value":3569},{"type":393,"tag":427,"props":3588,"children":3589},{"style":439},[3590],{"type":398,"value":511},{"type":393,"tag":427,"props":3592,"children":3593},{"style":493},[3594],{"type":398,"value":3595},"'Clothing'",{"type":393,"tag":427,"props":3597,"children":3598},{"style":439},[3599],{"type":398,"value":511},{"type":393,"tag":427,"props":3601,"children":3602},{"style":493},[3603],{"type":398,"value":3578},{"type":393,"tag":427,"props":3605,"children":3606},{"style":439},[3607],{"type":398,"value":546},{"type":393,"tag":427,"props":3609,"children":3610},{"class":429,"line":63},[3611,3616,3620,3625,3629,3634,3638,3643,3647,3652,3656,3660],{"type":393,"tag":427,"props":3612,"children":3613},{"style":493},[3614],{"type":398,"value":3615},"    'price'",{"type":393,"tag":427,"props":3617,"children":3618},{"style":439},[3619],{"type":398,"value":501},{"type":393,"tag":427,"props":3621,"children":3622},{"style":618},[3623],{"type":398,"value":3624},"299",{"type":393,"tag":427,"props":3626,"children":3627},{"style":439},[3628],{"type":398,"value":511},{"type":393,"tag":427,"props":3630,"children":3631},{"style":618},[3632],{"type":398,"value":3633},"15",{"type":393,"tag":427,"props":3635,"children":3636},{"style":439},[3637],{"type":398,"value":511},{"type":393,"tag":427,"props":3639,"children":3640},{"style":618},[3641],{"type":398,"value":3642},"199",{"type":393,"tag":427,"props":3644,"children":3645},{"style":439},[3646],{"type":398,"value":511},{"type":393,"tag":427,"props":3648,"children":3649},{"style":618},[3650],{"type":398,"value":3651},"45",{"type":393,"tag":427,"props":3653,"children":3654},{"style":439},[3655],{"type":398,"value":511},{"type":393,"tag":427,"props":3657,"children":3658},{"style":618},[3659],{"type":398,"value":1129},{"type":393,"tag":427,"props":3661,"children":3662},{"style":439},[3663],{"type":398,"value":546},{"type":393,"tag":427,"props":3665,"children":3666},{"class":429,"line":72},[3667,3671,3675,3680,3684,3689,3693,3698,3702,3707,3711,3716],{"type":393,"tag":427,"props":3668,"children":3669},{"style":493},[3670],{"type":398,"value":2205},{"type":393,"tag":427,"props":3672,"children":3673},{"style":439},[3674],{"type":398,"value":501},{"type":393,"tag":427,"props":3676,"children":3677},{"style":618},[3678],{"type":398,"value":3679},"4.5",{"type":393,"tag":427,"props":3681,"children":3682},{"style":439},[3683],{"type":398,"value":511},{"type":393,"tag":427,"props":3685,"children":3686},{"style":618},[3687],{"type":398,"value":3688},"4.0",{"type":393,"tag":427,"props":3690,"children":3691},{"style":439},[3692],{"type":398,"value":511},{"type":393,"tag":427,"props":3694,"children":3695},{"style":618},[3696],{"type":398,"value":3697},"4.2",{"type":393,"tag":427,"props":3699,"children":3700},{"style":439},[3701],{"type":398,"value":511},{"type":393,"tag":427,"props":3703,"children":3704},{"style":618},[3705],{"type":398,"value":3706},"3.8",{"type":393,"tag":427,"props":3708,"children":3709},{"style":439},[3710],{"type":398,"value":511},{"type":393,"tag":427,"props":3712,"children":3713},{"style":618},[3714],{"type":398,"value":3715},"4.1",{"type":393,"tag":427,"props":3717,"children":3718},{"style":439},[3719],{"type":398,"value":662},{"type":393,"tag":427,"props":3721,"children":3722},{"class":429,"line":83},[3723],{"type":393,"tag":427,"props":3724,"children":3725},{"style":439},[3726],{"type":398,"value":670},{"type":393,"tag":427,"props":3728,"children":3729},{"class":429,"line":92},[3730],{"type":393,"tag":427,"props":3731,"children":3732},{"emptyLinePlaceholder":12},[3733],{"type":398,"value":460},{"type":393,"tag":427,"props":3735,"children":3736},{"class":429,"line":101},[3737,3741,3745,3750],{"type":393,"tag":427,"props":3738,"children":3739},{"style":618},[3740],{"type":398,"value":685},{"type":393,"tag":427,"props":3742,"children":3743},{"style":439},[3744],{"type":398,"value":690},{"type":393,"tag":427,"props":3746,"children":3747},{"style":493},[3748],{"type":398,"value":3749},"\"Product data:\"",{"type":393,"tag":427,"props":3751,"children":3752},{"style":439},[3753],{"type":398,"value":700},{"type":393,"tag":427,"props":3755,"children":3756},{"class":429,"line":110},[3757,3761],{"type":393,"tag":427,"props":3758,"children":3759},{"style":618},[3760],{"type":398,"value":685},{"type":393,"tag":427,"props":3762,"children":3763},{"style":439},[3764],{"type":398,"value":3765},"(products)\n",{"type":393,"tag":427,"props":3767,"children":3768},{"class":429,"line":121},[3769,3773],{"type":393,"tag":427,"props":3770,"children":3771},{"style":618},[3772],{"type":398,"value":685},{"type":393,"tag":427,"props":3774,"children":3775},{"style":439},[3776],{"type":398,"value":724},{"type":393,"tag":427,"props":3778,"children":3779},{"class":429,"line":130},[3780],{"type":393,"tag":427,"props":3781,"children":3782},{"emptyLinePlaceholder":12},[3783],{"type":398,"value":460},{"type":393,"tag":427,"props":3785,"children":3786},{"class":429,"line":139},[3787],{"type":393,"tag":427,"props":3788,"children":3789},{"style":466},[3790],{"type":398,"value":3791},"# GroupBy with reset_index to get DataFrame\n",{"type":393,"tag":427,"props":3793,"children":3794},{"class":429,"line":148},[3795,3800,3804,3809,3814],{"type":393,"tag":427,"props":3796,"children":3797},{"style":439},[3798],{"type":398,"value":3799},"category_stats ",{"type":393,"tag":427,"props":3801,"children":3802},{"style":433},[3803],{"type":398,"value":482},{"type":393,"tag":427,"props":3805,"children":3806},{"style":439},[3807],{"type":398,"value":3808}," products.groupby(",{"type":393,"tag":427,"props":3810,"children":3811},{"style":493},[3812],{"type":398,"value":3813},"'category'",{"type":393,"tag":427,"props":3815,"children":3816},{"style":439},[3817],{"type":398,"value":3386},{"type":393,"tag":427,"props":3819,"children":3820},{"class":429,"line":159},[3821,3825,3830,3834],{"type":393,"tag":427,"props":3822,"children":3823},{"style":493},[3824],{"type":398,"value":3615},{"type":393,"tag":427,"props":3826,"children":3827},{"style":439},[3828],{"type":398,"value":3829},": ",{"type":393,"tag":427,"props":3831,"children":3832},{"style":493},[3833],{"type":398,"value":3411},{"type":393,"tag":427,"props":3835,"children":3836},{"style":439},[3837],{"type":398,"value":3838},",\n",{"type":393,"tag":427,"props":3840,"children":3841},{"class":429,"line":168},[3842,3846,3850],{"type":393,"tag":427,"props":3843,"children":3844},{"style":493},[3845],{"type":398,"value":2205},{"type":393,"tag":427,"props":3847,"children":3848},{"style":439},[3849],{"type":398,"value":3829},{"type":393,"tag":427,"props":3851,"children":3852},{"style":493},[3853],{"type":398,"value":3854},"'mean'\n",{"type":393,"tag":427,"props":3856,"children":3857},{"class":429,"line":177},[3858],{"type":393,"tag":427,"props":3859,"children":3860},{"style":439},[3861],{"type":398,"value":3862},"}).reset_index()\n",{"type":393,"tag":427,"props":3864,"children":3865},{"class":429,"line":186},[3866],{"type":393,"tag":427,"props":3867,"children":3868},{"emptyLinePlaceholder":12},[3869],{"type":398,"value":460},{"type":393,"tag":427,"props":3871,"children":3872},{"class":429,"line":197},[3873,3877,3881,3886],{"type":393,"tag":427,"props":3874,"children":3875},{"style":618},[3876],{"type":398,"value":685},{"type":393,"tag":427,"props":3878,"children":3879},{"style":439},[3880],{"type":398,"value":690},{"type":393,"tag":427,"props":3882,"children":3883},{"style":493},[3884],{"type":398,"value":3885},"\"Category statistics (as DataFrame):\"",{"type":393,"tag":427,"props":3887,"children":3888},{"style":439},[3889],{"type":398,"value":700},{"type":393,"tag":427,"props":3891,"children":3892},{"class":429,"line":206},[3893,3897],{"type":393,"tag":427,"props":3894,"children":3895},{"style":618},[3896],{"type":398,"value":685},{"type":393,"tag":427,"props":3898,"children":3899},{"style":439},[3900],{"type":398,"value":3901},"(category_stats)\n",{"type":393,"tag":427,"props":3903,"children":3904},{"class":429,"line":215},[3905,3909],{"type":393,"tag":427,"props":3906,"children":3907},{"style":618},[3908],{"type":398,"value":685},{"type":393,"tag":427,"props":3910,"children":3911},{"style":439},[3912],{"type":398,"value":724},{"type":393,"tag":427,"props":3914,"children":3915},{"class":429,"line":224},[3916],{"type":393,"tag":427,"props":3917,"children":3918},{"emptyLinePlaceholder":12},[3919],{"type":398,"value":460},{"type":393,"tag":427,"props":3921,"children":3922},{"class":429,"line":233},[3923],{"type":393,"tag":427,"props":3924,"children":3925},{"style":466},[3926],{"type":398,"value":3927},"# Add descriptive column names\n",{"type":393,"tag":427,"props":3929,"children":3930},{"class":429,"line":244},[3931,3936,3940,3945,3950,3954,3959,3963,3968],{"type":393,"tag":427,"props":3932,"children":3933},{"style":439},[3934],{"type":398,"value":3935},"category_stats.columns ",{"type":393,"tag":427,"props":3937,"children":3938},{"style":433},[3939],{"type":398,"value":482},{"type":393,"tag":427,"props":3941,"children":3942},{"style":439},[3943],{"type":398,"value":3944}," [",{"type":393,"tag":427,"props":3946,"children":3947},{"style":493},[3948],{"type":398,"value":3949},"'Category'",{"type":393,"tag":427,"props":3951,"children":3952},{"style":439},[3953],{"type":398,"value":511},{"type":393,"tag":427,"props":3955,"children":3956},{"style":493},[3957],{"type":398,"value":3958},"'Average Price'",{"type":393,"tag":427,"props":3960,"children":3961},{"style":439},[3962],{"type":398,"value":511},{"type":393,"tag":427,"props":3964,"children":3965},{"style":493},[3966],{"type":398,"value":3967},"'Average Rating'",{"type":393,"tag":427,"props":3969,"children":3970},{"style":439},[3971],{"type":398,"value":662},{"type":393,"tag":427,"props":3973,"children":3974},{"class":429,"line":253},[3975,3979,3983,3988],{"type":393,"tag":427,"props":3976,"children":3977},{"style":618},[3978],{"type":398,"value":685},{"type":393,"tag":427,"props":3980,"children":3981},{"style":439},[3982],{"type":398,"value":690},{"type":393,"tag":427,"props":3984,"children":3985},{"style":493},[3986],{"type":398,"value":3987},"\"With better column names:\"",{"type":393,"tag":427,"props":3989,"children":3990},{"style":439},[3991],{"type":398,"value":700},{"type":393,"tag":427,"props":3993,"children":3994},{"class":429,"line":262},[3995,3999],{"type":393,"tag":427,"props":3996,"children":3997},{"style":618},[3998],{"type":398,"value":685},{"type":393,"tag":427,"props":4000,"children":4001},{"style":439},[4002],{"type":398,"value":3901},{"type":393,"tag":810,"props":4004,"children":4006},{"id":4005},"filtering-groups",[4007],{"type":398,"value":4008},"🎯 Filtering Groups",{"type":393,"tag":401,"props":4010,"children":4011},{},[4012],{"type":398,"value":4013},"You can filter groups based on their characteristics:",{"type":393,"tag":412,"props":4015,"children":4016},{},[4017],{"type":393,"tag":416,"props":4018,"children":4020},{"className":418,"code":4019,"language":420,"meta":6,"style":6},"import pandas as pd\n\n# Customer transactions\ntransactions = pd.DataFrame({\n    'customer': ['Alice', 'Bob', 'Alice', 'Charlie', 'Bob', 'Alice', 'Diana'],\n    'amount': [100, 50, 150, 75, 200, 80, 300]\n})\n\nprint(\"Transaction data:\")\nprint(transactions)\nprint()\n\n# Filter groups with more than 2 transactions\nfrequent_customers = transactions.groupby('customer').filter(lambda x: len(x) > 2)\nprint(\"Customers with more than 2 transactions:\")\nprint(frequent_customers)\nprint()\n\n# Get customers who spent more than $200 total\nbig_spenders = transactions.groupby('customer')['amount'].sum()\nbig_spenders = big_spenders[big_spenders > 200]\nprint(\"Customers who spent more than $200:\")\nprint(big_spenders)\n",[4021],{"type":393,"tag":423,"props":4022,"children":4023},{"__ignoreMap":6},[4024,4043,4050,4058,4074,4141,4211,4218,4225,4245,4257,4268,4275,4283,4343,4363,4375,4386,4393,4401,4433,4462,4482],{"type":393,"tag":427,"props":4025,"children":4026},{"class":429,"line":11},[4027,4031,4035,4039],{"type":393,"tag":427,"props":4028,"children":4029},{"style":433},[4030],{"type":398,"value":436},{"type":393,"tag":427,"props":4032,"children":4033},{"style":439},[4034],{"type":398,"value":442},{"type":393,"tag":427,"props":4036,"children":4037},{"style":433},[4038],{"type":398,"value":447},{"type":393,"tag":427,"props":4040,"children":4041},{"style":439},[4042],{"type":398,"value":452},{"type":393,"tag":427,"props":4044,"children":4045},{"class":429,"line":27},[4046],{"type":393,"tag":427,"props":4047,"children":4048},{"emptyLinePlaceholder":12},[4049],{"type":398,"value":460},{"type":393,"tag":427,"props":4051,"children":4052},{"class":429,"line":36},[4053],{"type":393,"tag":427,"props":4054,"children":4055},{"style":466},[4056],{"type":398,"value":4057},"# Customer transactions\n",{"type":393,"tag":427,"props":4059,"children":4060},{"class":429,"line":45},[4061,4066,4070],{"type":393,"tag":427,"props":4062,"children":4063},{"style":439},[4064],{"type":398,"value":4065},"transactions ",{"type":393,"tag":427,"props":4067,"children":4068},{"style":433},[4069],{"type":398,"value":482},{"type":393,"tag":427,"props":4071,"children":4072},{"style":439},[4073],{"type":398,"value":487},{"type":393,"tag":427,"props":4075,"children":4076},{"class":429,"line":54},[4077,4081,4085,4089,4093,4097,4101,4105,4109,4113,4117,4121,4125,4129,4133,4137],{"type":393,"tag":427,"props":4078,"children":4079},{"style":493},[4080],{"type":398,"value":1003},{"type":393,"tag":427,"props":4082,"children":4083},{"style":439},[4084],{"type":398,"value":501},{"type":393,"tag":427,"props":4086,"children":4087},{"style":493},[4088],{"type":398,"value":563},{"type":393,"tag":427,"props":4090,"children":4091},{"style":439},[4092],{"type":398,"value":511},{"type":393,"tag":427,"props":4094,"children":4095},{"style":493},[4096],{"type":398,"value":572},{"type":393,"tag":427,"props":4098,"children":4099},{"style":439},[4100],{"type":398,"value":511},{"type":393,"tag":427,"props":4102,"children":4103},{"style":493},[4104],{"type":398,"value":563},{"type":393,"tag":427,"props":4106,"children":4107},{"style":439},[4108],{"type":398,"value":511},{"type":393,"tag":427,"props":4110,"children":4111},{"style":493},[4112],{"type":398,"value":581},{"type":393,"tag":427,"props":4114,"children":4115},{"style":439},[4116],{"type":398,"value":511},{"type":393,"tag":427,"props":4118,"children":4119},{"style":493},[4120],{"type":398,"value":572},{"type":393,"tag":427,"props":4122,"children":4123},{"style":439},[4124],{"type":398,"value":511},{"type":393,"tag":427,"props":4126,"children":4127},{"style":493},[4128],{"type":398,"value":563},{"type":393,"tag":427,"props":4130,"children":4131},{"style":439},[4132],{"type":398,"value":511},{"type":393,"tag":427,"props":4134,"children":4135},{"style":493},[4136],{"type":398,"value":590},{"type":393,"tag":427,"props":4138,"children":4139},{"style":439},[4140],{"type":398,"value":546},{"type":393,"tag":427,"props":4142,"children":4143},{"class":429,"line":63},[4144,4148,4152,4157,4161,4166,4170,4174,4178,4182,4186,4190,4194,4199,4203,4207],{"type":393,"tag":427,"props":4145,"children":4146},{"style":493},[4147],{"type":398,"value":1111},{"type":393,"tag":427,"props":4149,"children":4150},{"style":439},[4151],{"type":398,"value":501},{"type":393,"tag":427,"props":4153,"children":4154},{"style":618},[4155],{"type":398,"value":4156},"100",{"type":393,"tag":427,"props":4158,"children":4159},{"style":439},[4160],{"type":398,"value":511},{"type":393,"tag":427,"props":4162,"children":4163},{"style":618},[4164],{"type":398,"value":4165},"50",{"type":393,"tag":427,"props":4167,"children":4168},{"style":439},[4169],{"type":398,"value":511},{"type":393,"tag":427,"props":4171,"children":4172},{"style":618},[4173],{"type":398,"value":3248},{"type":393,"tag":427,"props":4175,"children":4176},{"style":439},[4177],{"type":398,"value":511},{"type":393,"tag":427,"props":4179,"children":4180},{"style":618},[4181],{"type":398,"value":1138},{"type":393,"tag":427,"props":4183,"children":4184},{"style":439},[4185],{"type":398,"value":511},{"type":393,"tag":427,"props":4187,"children":4188},{"style":618},[4189],{"type":398,"value":3257},{"type":393,"tag":427,"props":4191,"children":4192},{"style":439},[4193],{"type":398,"value":511},{"type":393,"tag":427,"props":4195,"children":4196},{"style":618},[4197],{"type":398,"value":4198},"80",{"type":393,"tag":427,"props":4200,"children":4201},{"style":439},[4202],{"type":398,"value":511},{"type":393,"tag":427,"props":4204,"children":4205},{"style":618},[4206],{"type":398,"value":1147},{"type":393,"tag":427,"props":4208,"children":4209},{"style":439},[4210],{"type":398,"value":662},{"type":393,"tag":427,"props":4212,"children":4213},{"class":429,"line":72},[4214],{"type":393,"tag":427,"props":4215,"children":4216},{"style":439},[4217],{"type":398,"value":670},{"type":393,"tag":427,"props":4219,"children":4220},{"class":429,"line":83},[4221],{"type":393,"tag":427,"props":4222,"children":4223},{"emptyLinePlaceholder":12},[4224],{"type":398,"value":460},{"type":393,"tag":427,"props":4226,"children":4227},{"class":429,"line":92},[4228,4232,4236,4241],{"type":393,"tag":427,"props":4229,"children":4230},{"style":618},[4231],{"type":398,"value":685},{"type":393,"tag":427,"props":4233,"children":4234},{"style":439},[4235],{"type":398,"value":690},{"type":393,"tag":427,"props":4237,"children":4238},{"style":493},[4239],{"type":398,"value":4240},"\"Transaction data:\"",{"type":393,"tag":427,"props":4242,"children":4243},{"style":439},[4244],{"type":398,"value":700},{"type":393,"tag":427,"props":4246,"children":4247},{"class":429,"line":101},[4248,4252],{"type":393,"tag":427,"props":4249,"children":4250},{"style":618},[4251],{"type":398,"value":685},{"type":393,"tag":427,"props":4253,"children":4254},{"style":439},[4255],{"type":398,"value":4256},"(transactions)\n",{"type":393,"tag":427,"props":4258,"children":4259},{"class":429,"line":110},[4260,4264],{"type":393,"tag":427,"props":4261,"children":4262},{"style":618},[4263],{"type":398,"value":685},{"type":393,"tag":427,"props":4265,"children":4266},{"style":439},[4267],{"type":398,"value":724},{"type":393,"tag":427,"props":4269,"children":4270},{"class":429,"line":121},[4271],{"type":393,"tag":427,"props":4272,"children":4273},{"emptyLinePlaceholder":12},[4274],{"type":398,"value":460},{"type":393,"tag":427,"props":4276,"children":4277},{"class":429,"line":130},[4278],{"type":393,"tag":427,"props":4279,"children":4280},{"style":466},[4281],{"type":398,"value":4282},"# Filter groups with more than 2 transactions\n",{"type":393,"tag":427,"props":4284,"children":4285},{"class":429,"line":139},[4286,4291,4295,4300,4304,4309,4314,4319,4324,4329,4334,4339],{"type":393,"tag":427,"props":4287,"children":4288},{"style":439},[4289],{"type":398,"value":4290},"frequent_customers ",{"type":393,"tag":427,"props":4292,"children":4293},{"style":433},[4294],{"type":398,"value":482},{"type":393,"tag":427,"props":4296,"children":4297},{"style":439},[4298],{"type":398,"value":4299}," transactions.groupby(",{"type":393,"tag":427,"props":4301,"children":4302},{"style":493},[4303],{"type":398,"value":1268},{"type":393,"tag":427,"props":4305,"children":4306},{"style":439},[4307],{"type":398,"value":4308},").filter(",{"type":393,"tag":427,"props":4310,"children":4311},{"style":433},[4312],{"type":398,"value":4313},"lambda",{"type":393,"tag":427,"props":4315,"children":4316},{"style":439},[4317],{"type":398,"value":4318}," x: ",{"type":393,"tag":427,"props":4320,"children":4321},{"style":618},[4322],{"type":398,"value":4323},"len",{"type":393,"tag":427,"props":4325,"children":4326},{"style":439},[4327],{"type":398,"value":4328},"(x) ",{"type":393,"tag":427,"props":4330,"children":4331},{"style":433},[4332],{"type":398,"value":4333},">",{"type":393,"tag":427,"props":4335,"children":4336},{"style":618},[4337],{"type":398,"value":4338}," 2",{"type":393,"tag":427,"props":4340,"children":4341},{"style":439},[4342],{"type":398,"value":700},{"type":393,"tag":427,"props":4344,"children":4345},{"class":429,"line":148},[4346,4350,4354,4359],{"type":393,"tag":427,"props":4347,"children":4348},{"style":618},[4349],{"type":398,"value":685},{"type":393,"tag":427,"props":4351,"children":4352},{"style":439},[4353],{"type":398,"value":690},{"type":393,"tag":427,"props":4355,"children":4356},{"style":493},[4357],{"type":398,"value":4358},"\"Customers with more than 2 transactions:\"",{"type":393,"tag":427,"props":4360,"children":4361},{"style":439},[4362],{"type":398,"value":700},{"type":393,"tag":427,"props":4364,"children":4365},{"class":429,"line":159},[4366,4370],{"type":393,"tag":427,"props":4367,"children":4368},{"style":618},[4369],{"type":398,"value":685},{"type":393,"tag":427,"props":4371,"children":4372},{"style":439},[4373],{"type":398,"value":4374},"(frequent_customers)\n",{"type":393,"tag":427,"props":4376,"children":4377},{"class":429,"line":168},[4378,4382],{"type":393,"tag":427,"props":4379,"children":4380},{"style":618},[4381],{"type":398,"value":685},{"type":393,"tag":427,"props":4383,"children":4384},{"style":439},[4385],{"type":398,"value":724},{"type":393,"tag":427,"props":4387,"children":4388},{"class":429,"line":177},[4389],{"type":393,"tag":427,"props":4390,"children":4391},{"emptyLinePlaceholder":12},[4392],{"type":398,"value":460},{"type":393,"tag":427,"props":4394,"children":4395},{"class":429,"line":186},[4396],{"type":393,"tag":427,"props":4397,"children":4398},{"style":466},[4399],{"type":398,"value":4400},"# Get customers who spent more than $200 total\n",{"type":393,"tag":427,"props":4402,"children":4403},{"class":429,"line":197},[4404,4409,4413,4417,4421,4425,4429],{"type":393,"tag":427,"props":4405,"children":4406},{"style":439},[4407],{"type":398,"value":4408},"big_spenders ",{"type":393,"tag":427,"props":4410,"children":4411},{"style":433},[4412],{"type":398,"value":482},{"type":393,"tag":427,"props":4414,"children":4415},{"style":439},[4416],{"type":398,"value":4299},{"type":393,"tag":427,"props":4418,"children":4419},{"style":493},[4420],{"type":398,"value":1268},{"type":393,"tag":427,"props":4422,"children":4423},{"style":439},[4424],{"type":398,"value":766},{"type":393,"tag":427,"props":4426,"children":4427},{"style":493},[4428],{"type":398,"value":1277},{"type":393,"tag":427,"props":4430,"children":4431},{"style":439},[4432],{"type":398,"value":776},{"type":393,"tag":427,"props":4434,"children":4435},{"class":429,"line":206},[4436,4440,4444,4449,4453,4458],{"type":393,"tag":427,"props":4437,"children":4438},{"style":439},[4439],{"type":398,"value":4408},{"type":393,"tag":427,"props":4441,"children":4442},{"style":433},[4443],{"type":398,"value":482},{"type":393,"tag":427,"props":4445,"children":4446},{"style":439},[4447],{"type":398,"value":4448}," big_spenders[big_spenders ",{"type":393,"tag":427,"props":4450,"children":4451},{"style":433},[4452],{"type":398,"value":4333},{"type":393,"tag":427,"props":4454,"children":4455},{"style":618},[4456],{"type":398,"value":4457}," 200",{"type":393,"tag":427,"props":4459,"children":4460},{"style":439},[4461],{"type":398,"value":662},{"type":393,"tag":427,"props":4463,"children":4464},{"class":429,"line":215},[4465,4469,4473,4478],{"type":393,"tag":427,"props":4466,"children":4467},{"style":618},[4468],{"type":398,"value":685},{"type":393,"tag":427,"props":4470,"children":4471},{"style":439},[4472],{"type":398,"value":690},{"type":393,"tag":427,"props":4474,"children":4475},{"style":493},[4476],{"type":398,"value":4477},"\"Customers who spent more than $200:\"",{"type":393,"tag":427,"props":4479,"children":4480},{"style":439},[4481],{"type":398,"value":700},{"type":393,"tag":427,"props":4483,"children":4484},{"class":429,"line":224},[4485,4489],{"type":393,"tag":427,"props":4486,"children":4487},{"style":618},[4488],{"type":398,"value":685},{"type":393,"tag":427,"props":4490,"children":4491},{"style":439},[4492],{"type":398,"value":4493},"(big_spenders)\n",{"type":393,"tag":810,"props":4495,"children":4497},{"id":4496},"groupby-with-different-data-types",[4498],{"type":398,"value":4499},"📊 GroupBy with Different Data Types",{"type":393,"tag":401,"props":4501,"children":4502},{},[4503],{"type":398,"value":4504},"GroupBy works with different types of data:",{"type":393,"tag":822,"props":4506,"children":4510},{"emoji":4507,"title":4508,"type":4509},"⚠️","GroupBy Data Type Considerations","warning",[4511,4519,4537,4545,4571,4579,4597],{"type":393,"tag":401,"props":4512,"children":4513},{},[4514],{"type":393,"tag":832,"props":4515,"children":4516},{},[4517],{"type":398,"value":4518},"Text Data:",{"type":393,"tag":838,"props":4520,"children":4521},{},[4522,4527,4532],{"type":393,"tag":842,"props":4523,"children":4524},{},[4525],{"type":398,"value":4526},"Groups by exact text matches",{"type":393,"tag":842,"props":4528,"children":4529},{},[4530],{"type":398,"value":4531},"Case sensitive: 'Sales' ≠ 'sales'",{"type":393,"tag":842,"props":4533,"children":4534},{},[4535],{"type":398,"value":4536},"Clean text data first for best results",{"type":393,"tag":401,"props":4538,"children":4539},{},[4540],{"type":393,"tag":832,"props":4541,"children":4542},{},[4543],{"type":398,"value":4544},"Numerical Data:",{"type":393,"tag":838,"props":4546,"children":4547},{},[4548,4553,4558],{"type":393,"tag":842,"props":4549,"children":4550},{},[4551],{"type":398,"value":4552},"Can group by exact numbers",{"type":393,"tag":842,"props":4554,"children":4555},{},[4556],{"type":398,"value":4557},"Consider binning continuous numbers first",{"type":393,"tag":842,"props":4559,"children":4560},{},[4561,4563,4569],{"type":398,"value":4562},"Use ",{"type":393,"tag":423,"props":4564,"children":4566},{"className":4565},[],[4567],{"type":398,"value":4568},"pd.cut()",{"type":398,"value":4570}," for ranges",{"type":393,"tag":401,"props":4572,"children":4573},{},[4574],{"type":393,"tag":832,"props":4575,"children":4576},{},[4577],{"type":398,"value":4578},"Date Data:",{"type":393,"tag":838,"props":4580,"children":4581},{},[4582,4587,4592],{"type":393,"tag":842,"props":4583,"children":4584},{},[4585],{"type":398,"value":4586},"Extract components first (.dt.year, .dt.month)",{"type":393,"tag":842,"props":4588,"children":4589},{},[4590],{"type":398,"value":4591},"Group by time periods for analysis",{"type":393,"tag":842,"props":4593,"children":4594},{},[4595],{"type":398,"value":4596},"Very powerful for time series analysis",{"type":393,"tag":401,"props":4598,"children":4599},{},[4600,4605],{"type":393,"tag":832,"props":4601,"children":4602},{},[4603],{"type":398,"value":4604},"Best Practice:",{"type":398,"value":4606}," Clean and prepare data before grouping!",{"type":393,"tag":810,"props":4608,"children":4610},{"id":4609},"key-takeaways",[4611],{"type":398,"value":4612},"🎯 Key Takeaways",{"type":393,"tag":822,"props":4614,"children":4617},{"emoji":4615,"title":4616,"type":1422},"📚","GroupBy Essentials",[4618,4626,4662,4670,4721,4729,4754,4762,4785],{"type":393,"tag":401,"props":4619,"children":4620},{},[4621],{"type":393,"tag":832,"props":4622,"children":4623},{},[4624],{"type":398,"value":4625},"Basic Syntax:",{"type":393,"tag":838,"props":4627,"children":4628},{},[4629,4640,4651],{"type":393,"tag":842,"props":4630,"children":4631},{},[4632,4638],{"type":393,"tag":423,"props":4633,"children":4635},{"className":4634},[],[4636],{"type":398,"value":4637},"df.groupby('column')['target'].function()",{"type":398,"value":4639}," - Single column grouping",{"type":393,"tag":842,"props":4641,"children":4642},{},[4643,4649],{"type":393,"tag":423,"props":4644,"children":4646},{"className":4645},[],[4647],{"type":398,"value":4648},"df.groupby(['col1', 'col2'])",{"type":398,"value":4650}," - Multiple column grouping",{"type":393,"tag":842,"props":4652,"children":4653},{},[4654,4660],{"type":393,"tag":423,"props":4655,"children":4657},{"className":4656},[],[4658],{"type":398,"value":4659},".agg(['func1', 'func2'])",{"type":398,"value":4661}," - Multiple functions",{"type":393,"tag":401,"props":4663,"children":4664},{},[4665],{"type":393,"tag":832,"props":4666,"children":4667},{},[4668],{"type":398,"value":4669},"Common Functions:",{"type":393,"tag":838,"props":4671,"children":4672},{},[4673,4689,4705],{"type":393,"tag":842,"props":4674,"children":4675},{},[4676,4681,4682,4687],{"type":393,"tag":423,"props":4677,"children":4679},{"className":4678},[],[4680],{"type":398,"value":1443},{"type":398,"value":511},{"type":393,"tag":423,"props":4683,"children":4685},{"className":4684},[],[4686],{"type":398,"value":1454},{"type":398,"value":4688}," - Mathematical aggregations",{"type":393,"tag":842,"props":4690,"children":4691},{},[4692,4697,4698,4703],{"type":393,"tag":423,"props":4693,"children":4695},{"className":4694},[],[4696],{"type":398,"value":1505},{"type":398,"value":511},{"type":393,"tag":423,"props":4699,"children":4701},{"className":4700},[],[4702],{"type":398,"value":1516},{"type":398,"value":4704}," - Counting operations",{"type":393,"tag":842,"props":4706,"children":4707},{},[4708,4713,4714,4719],{"type":393,"tag":423,"props":4709,"children":4711},{"className":4710},[],[4712],{"type":398,"value":1465},{"type":398,"value":511},{"type":393,"tag":423,"props":4715,"children":4717},{"className":4716},[],[4718],{"type":398,"value":1472},{"type":398,"value":4720}," - Range operations",{"type":393,"tag":401,"props":4722,"children":4723},{},[4724],{"type":393,"tag":832,"props":4725,"children":4726},{},[4727],{"type":398,"value":4728},"Result Handling:",{"type":393,"tag":838,"props":4730,"children":4731},{},[4732,4737,4749],{"type":393,"tag":842,"props":4733,"children":4734},{},[4735],{"type":398,"value":4736},"Results are Series or DataFrames",{"type":393,"tag":842,"props":4738,"children":4739},{},[4740,4741,4747],{"type":398,"value":4562},{"type":393,"tag":423,"props":4742,"children":4744},{"className":4743},[],[4745],{"type":398,"value":4746},".reset_index()",{"type":398,"value":4748}," to convert to DataFrame",{"type":393,"tag":842,"props":4750,"children":4751},{},[4752],{"type":398,"value":4753},"Rename columns for clarity",{"type":393,"tag":401,"props":4755,"children":4756},{},[4757],{"type":393,"tag":832,"props":4758,"children":4759},{},[4760],{"type":398,"value":4761},"Best Practices:",{"type":393,"tag":838,"props":4763,"children":4764},{},[4765,4770,4775,4780],{"type":393,"tag":842,"props":4766,"children":4767},{},[4768],{"type":398,"value":4769},"Clean data before grouping",{"type":393,"tag":842,"props":4771,"children":4772},{},[4773],{"type":398,"value":4774},"Choose meaningful grouping columns",{"type":393,"tag":842,"props":4776,"children":4777},{},[4778],{"type":398,"value":4779},"Use appropriate aggregation functions",{"type":393,"tag":842,"props":4781,"children":4782},{},[4783],{"type":398,"value":4784},"Verify group sizes make sense",{"type":393,"tag":401,"props":4786,"children":4787},{},[4788,4793],{"type":393,"tag":832,"props":4789,"children":4790},{},[4791],{"type":398,"value":4792},"Remember:",{"type":398,"value":4794}," GroupBy reveals patterns hidden in individual rows!",{"type":393,"tag":810,"props":4796,"children":4798},{"id":4797},"whats-next",[4799],{"type":398,"value":4800},"🚀 What's Next?",{"type":393,"tag":401,"props":4802,"children":4803},{},[4804],{"type":398,"value":4805},"Excellent! You now understand the fundamentals of GroupBy operations. Next, let's explore more advanced aggregation functions and custom operations.",{"type":393,"tag":401,"props":4807,"children":4808},{},[4809,4814,4815],{"type":393,"tag":832,"props":4810,"children":4811},{},[4812],{"type":398,"value":4813},"Continue to",{"type":398,"value":3829},{"type":393,"tag":4816,"props":4817,"children":4818},"a",{"href":286},[4819],{"type":398,"value":287},{"type":393,"tag":401,"props":4821,"children":4822},{},[4823],{"type":398,"value":4824},"Keep grouping! 🔗📊",{"type":393,"tag":4826,"props":4827,"children":4828},"style",{},[4829],{"type":398,"value":4830},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .app-dark-mode .shiki span {color: var(--shiki-app-dark-mode);background: var(--shiki-app-dark-mode-bg);font-style: var(--shiki-app-dark-mode-font-style);font-weight: var(--shiki-app-dark-mode-font-weight);text-decoration: var(--shiki-app-dark-mode-text-decoration);}html.app-dark-mode .shiki span {color: var(--shiki-app-dark-mode);background: var(--shiki-app-dark-mode-bg);font-style: var(--shiki-app-dark-mode-font-style);font-weight: var(--shiki-app-dark-mode-font-weight);text-decoration: var(--shiki-app-dark-mode-text-decoration);}",{"title":6,"searchDepth":36,"depth":36,"links":4832},[4833,4834,4835,4839,4840,4841,4842,4843,4844,4845],{"id":812,"depth":27,"text":815},{"id":921,"depth":27,"text":924},{"id":1409,"depth":27,"text":1412,"children":4836},[4837,4838],{"id":1599,"depth":36,"text":1602},{"id":2075,"depth":36,"text":2078},{"id":2568,"depth":27,"text":2571},{"id":2975,"depth":27,"text":2978},{"id":3484,"depth":27,"text":3487},{"id":4005,"depth":27,"text":4008},{"id":4496,"depth":27,"text":4499},{"id":4609,"depth":27,"text":4612},{"id":4797,"depth":27,"text":4800},1782373725864]