[{"data":1,"prerenderedAt":5461},["ShallowReactive",2],{"tutorials-pandas":3,"category-items-pandas":387,"content-/pandas/aggregation-functions":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",[285],{"_path":286,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":287,"description":288,"slug":289,"parentId":267,"order":290,"body":389,"_type":14,"_id":291,"_source":16,"_file":292,"_stem":293,"_extension":19},{"type":390,"children":391,"toc":5447},"root",[392,400,406,411,927,934,939,1136,1142,1147,1638,1644,1649,1753,2205,2211,2216,2761,2767,2772,3372,3378,3383,4056,4062,4067,4154,4672,4678,4685,4772,5219,5225,5411,5417,5422,5436,5441],{"type":393,"tag":394,"props":395,"children":396},"element","h1",{"id":289},[397],{"type":398,"value":399},"text","📈 Aggregation Functions",{"type":393,"tag":401,"props":402,"children":403},"p",{},[404],{"type":398,"value":405},"Aggregation functions are the tools that turn groups of data into meaningful summaries! Once you've grouped your data, these functions help you calculate totals, averages, counts, and much more. Mastering aggregation functions will unlock powerful insights in your data.",{"type":393,"tag":401,"props":407,"children":408},{},[409],{"type":398,"value":410},"Think of aggregation functions like different ways to summarize a book - you could count the pages, find the average word length, or identify the most common theme.",{"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# Sales team performance\nteam = pd.DataFrame({\n    'region': ['North', 'South', 'North', 'South', 'North'],\n    'salesperson': ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve'],\n    'sales': [85000, 92000, 78000, 88000, 95000],\n    'calls': [150, 180, 120, 160, 200]\n})\n\nprint(\"Sales team data:\")\nprint(team)\nprint()\n\n# Multiple aggregation functions\nsummary = team.groupby('region').agg({\n    'sales': ['sum', 'mean', 'max'],\n    'calls': ['sum', 'mean']\n})\nprint(\"Region summary:\")\nprint(summary)\n","python",[422],{"type":393,"tag":423,"props":424,"children":425},"code",{"__ignoreMap":6},[426,453,461,470,488,546,603,661,719,727,734,757,769,781,788,796,823,861,888,895,915],{"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},"# Sales team performance\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},"team ",{"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,533,537,541],{"type":393,"tag":427,"props":492,"children":494},{"style":493},"--shiki-default:#032F62;--shiki-app-dark-mode:#9ECBFF",[495],{"type":398,"value":496},"    'region'",{"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},"'North'",{"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},"'South'",{"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":516},{"type":393,"tag":427,"props":534,"children":535},{"style":439},[536],{"type":398,"value":511},{"type":393,"tag":427,"props":538,"children":539},{"style":493},[540],{"type":398,"value":506},{"type":393,"tag":427,"props":542,"children":543},{"style":439},[544],{"type":398,"value":545},"],\n",{"type":393,"tag":427,"props":547,"children":548},{"class":429,"line":63},[549,554,558,563,567,572,576,581,585,590,594,599],{"type":393,"tag":427,"props":550,"children":551},{"style":493},[552],{"type":398,"value":553},"    'salesperson'",{"type":393,"tag":427,"props":555,"children":556},{"style":439},[557],{"type":398,"value":501},{"type":393,"tag":427,"props":559,"children":560},{"style":493},[561],{"type":398,"value":562},"'Alice'",{"type":393,"tag":427,"props":564,"children":565},{"style":439},[566],{"type":398,"value":511},{"type":393,"tag":427,"props":568,"children":569},{"style":493},[570],{"type":398,"value":571},"'Bob'",{"type":393,"tag":427,"props":573,"children":574},{"style":439},[575],{"type":398,"value":511},{"type":393,"tag":427,"props":577,"children":578},{"style":493},[579],{"type":398,"value":580},"'Charlie'",{"type":393,"tag":427,"props":582,"children":583},{"style":439},[584],{"type":398,"value":511},{"type":393,"tag":427,"props":586,"children":587},{"style":493},[588],{"type":398,"value":589},"'Diana'",{"type":393,"tag":427,"props":591,"children":592},{"style":439},[593],{"type":398,"value":511},{"type":393,"tag":427,"props":595,"children":596},{"style":493},[597],{"type":398,"value":598},"'Eve'",{"type":393,"tag":427,"props":600,"children":601},{"style":439},[602],{"type":398,"value":545},{"type":393,"tag":427,"props":604,"children":605},{"class":429,"line":72},[606,611,615,621,625,630,634,639,643,648,652,657],{"type":393,"tag":427,"props":607,"children":608},{"style":493},[609],{"type":398,"value":610},"    'sales'",{"type":393,"tag":427,"props":612,"children":613},{"style":439},[614],{"type":398,"value":501},{"type":393,"tag":427,"props":616,"children":618},{"style":617},"--shiki-default:#005CC5;--shiki-app-dark-mode:#79B8FF",[619],{"type":398,"value":620},"85000",{"type":393,"tag":427,"props":622,"children":623},{"style":439},[624],{"type":398,"value":511},{"type":393,"tag":427,"props":626,"children":627},{"style":617},[628],{"type":398,"value":629},"92000",{"type":393,"tag":427,"props":631,"children":632},{"style":439},[633],{"type":398,"value":511},{"type":393,"tag":427,"props":635,"children":636},{"style":617},[637],{"type":398,"value":638},"78000",{"type":393,"tag":427,"props":640,"children":641},{"style":439},[642],{"type":398,"value":511},{"type":393,"tag":427,"props":644,"children":645},{"style":617},[646],{"type":398,"value":647},"88000",{"type":393,"tag":427,"props":649,"children":650},{"style":439},[651],{"type":398,"value":511},{"type":393,"tag":427,"props":653,"children":654},{"style":617},[655],{"type":398,"value":656},"95000",{"type":393,"tag":427,"props":658,"children":659},{"style":439},[660],{"type":398,"value":545},{"type":393,"tag":427,"props":662,"children":663},{"class":429,"line":83},[664,669,673,678,682,687,691,696,700,705,709,714],{"type":393,"tag":427,"props":665,"children":666},{"style":493},[667],{"type":398,"value":668},"    'calls'",{"type":393,"tag":427,"props":670,"children":671},{"style":439},[672],{"type":398,"value":501},{"type":393,"tag":427,"props":674,"children":675},{"style":617},[676],{"type":398,"value":677},"150",{"type":393,"tag":427,"props":679,"children":680},{"style":439},[681],{"type":398,"value":511},{"type":393,"tag":427,"props":683,"children":684},{"style":617},[685],{"type":398,"value":686},"180",{"type":393,"tag":427,"props":688,"children":689},{"style":439},[690],{"type":398,"value":511},{"type":393,"tag":427,"props":692,"children":693},{"style":617},[694],{"type":398,"value":695},"120",{"type":393,"tag":427,"props":697,"children":698},{"style":439},[699],{"type":398,"value":511},{"type":393,"tag":427,"props":701,"children":702},{"style":617},[703],{"type":398,"value":704},"160",{"type":393,"tag":427,"props":706,"children":707},{"style":439},[708],{"type":398,"value":511},{"type":393,"tag":427,"props":710,"children":711},{"style":617},[712],{"type":398,"value":713},"200",{"type":393,"tag":427,"props":715,"children":716},{"style":439},[717],{"type":398,"value":718},"]\n",{"type":393,"tag":427,"props":720,"children":721},{"class":429,"line":92},[722],{"type":393,"tag":427,"props":723,"children":724},{"style":439},[725],{"type":398,"value":726},"})\n",{"type":393,"tag":427,"props":728,"children":729},{"class":429,"line":101},[730],{"type":393,"tag":427,"props":731,"children":732},{"emptyLinePlaceholder":12},[733],{"type":398,"value":460},{"type":393,"tag":427,"props":735,"children":736},{"class":429,"line":110},[737,742,747,752],{"type":393,"tag":427,"props":738,"children":739},{"style":617},[740],{"type":398,"value":741},"print",{"type":393,"tag":427,"props":743,"children":744},{"style":439},[745],{"type":398,"value":746},"(",{"type":393,"tag":427,"props":748,"children":749},{"style":493},[750],{"type":398,"value":751},"\"Sales team data:\"",{"type":393,"tag":427,"props":753,"children":754},{"style":439},[755],{"type":398,"value":756},")\n",{"type":393,"tag":427,"props":758,"children":759},{"class":429,"line":121},[760,764],{"type":393,"tag":427,"props":761,"children":762},{"style":617},[763],{"type":398,"value":741},{"type":393,"tag":427,"props":765,"children":766},{"style":439},[767],{"type":398,"value":768},"(team)\n",{"type":393,"tag":427,"props":770,"children":771},{"class":429,"line":130},[772,776],{"type":393,"tag":427,"props":773,"children":774},{"style":617},[775],{"type":398,"value":741},{"type":393,"tag":427,"props":777,"children":778},{"style":439},[779],{"type":398,"value":780},"()\n",{"type":393,"tag":427,"props":782,"children":783},{"class":429,"line":139},[784],{"type":393,"tag":427,"props":785,"children":786},{"emptyLinePlaceholder":12},[787],{"type":398,"value":460},{"type":393,"tag":427,"props":789,"children":790},{"class":429,"line":148},[791],{"type":393,"tag":427,"props":792,"children":793},{"style":466},[794],{"type":398,"value":795},"# Multiple aggregation functions\n",{"type":393,"tag":427,"props":797,"children":798},{"class":429,"line":159},[799,804,808,813,818],{"type":393,"tag":427,"props":800,"children":801},{"style":439},[802],{"type":398,"value":803},"summary ",{"type":393,"tag":427,"props":805,"children":806},{"style":433},[807],{"type":398,"value":482},{"type":393,"tag":427,"props":809,"children":810},{"style":439},[811],{"type":398,"value":812}," team.groupby(",{"type":393,"tag":427,"props":814,"children":815},{"style":493},[816],{"type":398,"value":817},"'region'",{"type":393,"tag":427,"props":819,"children":820},{"style":439},[821],{"type":398,"value":822},").agg({\n",{"type":393,"tag":427,"props":824,"children":825},{"class":429,"line":168},[826,830,834,839,843,848,852,857],{"type":393,"tag":427,"props":827,"children":828},{"style":493},[829],{"type":398,"value":610},{"type":393,"tag":427,"props":831,"children":832},{"style":439},[833],{"type":398,"value":501},{"type":393,"tag":427,"props":835,"children":836},{"style":493},[837],{"type":398,"value":838},"'sum'",{"type":393,"tag":427,"props":840,"children":841},{"style":439},[842],{"type":398,"value":511},{"type":393,"tag":427,"props":844,"children":845},{"style":493},[846],{"type":398,"value":847},"'mean'",{"type":393,"tag":427,"props":849,"children":850},{"style":439},[851],{"type":398,"value":511},{"type":393,"tag":427,"props":853,"children":854},{"style":493},[855],{"type":398,"value":856},"'max'",{"type":393,"tag":427,"props":858,"children":859},{"style":439},[860],{"type":398,"value":545},{"type":393,"tag":427,"props":862,"children":863},{"class":429,"line":177},[864,868,872,876,880,884],{"type":393,"tag":427,"props":865,"children":866},{"style":493},[867],{"type":398,"value":668},{"type":393,"tag":427,"props":869,"children":870},{"style":439},[871],{"type":398,"value":501},{"type":393,"tag":427,"props":873,"children":874},{"style":493},[875],{"type":398,"value":838},{"type":393,"tag":427,"props":877,"children":878},{"style":439},[879],{"type":398,"value":511},{"type":393,"tag":427,"props":881,"children":882},{"style":493},[883],{"type":398,"value":847},{"type":393,"tag":427,"props":885,"children":886},{"style":439},[887],{"type":398,"value":718},{"type":393,"tag":427,"props":889,"children":890},{"class":429,"line":186},[891],{"type":393,"tag":427,"props":892,"children":893},{"style":439},[894],{"type":398,"value":726},{"type":393,"tag":427,"props":896,"children":897},{"class":429,"line":197},[898,902,906,911],{"type":393,"tag":427,"props":899,"children":900},{"style":617},[901],{"type":398,"value":741},{"type":393,"tag":427,"props":903,"children":904},{"style":439},[905],{"type":398,"value":746},{"type":393,"tag":427,"props":907,"children":908},{"style":493},[909],{"type":398,"value":910},"\"Region summary:\"",{"type":393,"tag":427,"props":912,"children":913},{"style":439},[914],{"type":398,"value":756},{"type":393,"tag":427,"props":916,"children":917},{"class":429,"line":206},[918,922],{"type":393,"tag":427,"props":919,"children":920},{"style":617},[921],{"type":398,"value":741},{"type":393,"tag":427,"props":923,"children":924},{"style":439},[925],{"type":398,"value":926},"(summary)\n",{"type":393,"tag":928,"props":929,"children":931},"h2",{"id":930},"types-of-aggregation-functions",[932],{"type":398,"value":933},"🎯 Types of Aggregation Functions",{"type":393,"tag":401,"props":935,"children":936},{},[937],{"type":398,"value":938},"Pandas provides many built-in aggregation functions for different purposes:",{"type":393,"tag":940,"props":941,"children":945},"info-box",{"emoji":942,"title":943,"type":944},"📊","Aggregation Function Categories","info",[946,955,1015,1023,1059,1067,1103,1111],{"type":393,"tag":401,"props":947,"children":948},{},[949],{"type":393,"tag":950,"props":951,"children":952},"strong",{},[953],{"type":398,"value":954},"Statistical Functions:",{"type":393,"tag":956,"props":957,"children":958},"ul",{},[959,971,982,993,1004],{"type":393,"tag":960,"props":961,"children":962},"li",{},[963,969],{"type":393,"tag":423,"props":964,"children":966},{"className":965},[],[967],{"type":398,"value":968},"sum()",{"type":398,"value":970}," - Add all values together",{"type":393,"tag":960,"props":972,"children":973},{},[974,980],{"type":393,"tag":423,"props":975,"children":977},{"className":976},[],[978],{"type":398,"value":979},"mean()",{"type":398,"value":981}," - Calculate average",{"type":393,"tag":960,"props":983,"children":984},{},[985,991],{"type":393,"tag":423,"props":986,"children":988},{"className":987},[],[989],{"type":398,"value":990},"median()",{"type":398,"value":992}," - Find middle value",{"type":393,"tag":960,"props":994,"children":995},{},[996,1002],{"type":393,"tag":423,"props":997,"children":999},{"className":998},[],[1000],{"type":398,"value":1001},"std()",{"type":398,"value":1003}," - Standard deviation",{"type":393,"tag":960,"props":1005,"children":1006},{},[1007,1013],{"type":393,"tag":423,"props":1008,"children":1010},{"className":1009},[],[1011],{"type":398,"value":1012},"var()",{"type":398,"value":1014}," - Variance",{"type":393,"tag":401,"props":1016,"children":1017},{},[1018],{"type":393,"tag":950,"props":1019,"children":1020},{},[1021],{"type":398,"value":1022},"Range Functions:",{"type":393,"tag":956,"props":1024,"children":1025},{},[1026,1037,1048],{"type":393,"tag":960,"props":1027,"children":1028},{},[1029,1035],{"type":393,"tag":423,"props":1030,"children":1032},{"className":1031},[],[1033],{"type":398,"value":1034},"min()",{"type":398,"value":1036}," - Smallest value",{"type":393,"tag":960,"props":1038,"children":1039},{},[1040,1046],{"type":393,"tag":423,"props":1041,"children":1043},{"className":1042},[],[1044],{"type":398,"value":1045},"max()",{"type":398,"value":1047}," - Largest value",{"type":393,"tag":960,"props":1049,"children":1050},{},[1051,1057],{"type":393,"tag":423,"props":1052,"children":1054},{"className":1053},[],[1055],{"type":398,"value":1056},"quantile()",{"type":398,"value":1058}," - Percentile values",{"type":393,"tag":401,"props":1060,"children":1061},{},[1062],{"type":393,"tag":950,"props":1063,"children":1064},{},[1065],{"type":398,"value":1066},"Counting Functions:",{"type":393,"tag":956,"props":1068,"children":1069},{},[1070,1081,1092],{"type":393,"tag":960,"props":1071,"children":1072},{},[1073,1079],{"type":393,"tag":423,"props":1074,"children":1076},{"className":1075},[],[1077],{"type":398,"value":1078},"count()",{"type":398,"value":1080}," - Non-null values",{"type":393,"tag":960,"props":1082,"children":1083},{},[1084,1090],{"type":393,"tag":423,"props":1085,"children":1087},{"className":1086},[],[1088],{"type":398,"value":1089},"size()",{"type":398,"value":1091}," - All values (including nulls)",{"type":393,"tag":960,"props":1093,"children":1094},{},[1095,1101],{"type":393,"tag":423,"props":1096,"children":1098},{"className":1097},[],[1099],{"type":398,"value":1100},"nunique()",{"type":398,"value":1102}," - Unique values",{"type":393,"tag":401,"props":1104,"children":1105},{},[1106],{"type":393,"tag":950,"props":1107,"children":1108},{},[1109],{"type":398,"value":1110},"Selection Functions:",{"type":393,"tag":956,"props":1112,"children":1113},{},[1114,1125],{"type":393,"tag":960,"props":1115,"children":1116},{},[1117,1123],{"type":393,"tag":423,"props":1118,"children":1120},{"className":1119},[],[1121],{"type":398,"value":1122},"first()",{"type":398,"value":1124}," - First value in group",{"type":393,"tag":960,"props":1126,"children":1127},{},[1128,1134],{"type":393,"tag":423,"props":1129,"children":1131},{"className":1130},[],[1132],{"type":398,"value":1133},"last()",{"type":398,"value":1135}," - Last value in group",{"type":393,"tag":928,"props":1137,"children":1139},{"id":1138},"statistical-aggregations",[1140],{"type":398,"value":1141},"📊 Statistical Aggregations",{"type":393,"tag":401,"props":1143,"children":1144},{},[1145],{"type":398,"value":1146},"Statistical functions help you understand the distribution and central tendencies of your data:",{"type":393,"tag":412,"props":1148,"children":1149},{},[1150],{"type":393,"tag":416,"props":1151,"children":1153},{"className":418,"code":1152,"language":420,"meta":6,"style":6},"import pandas as pd\n\n# Student test scores\nscores = pd.DataFrame({\n    'subject': ['Math', 'Science', 'Math', 'Science', 'Math', 'Science'],\n    'student': ['Alice', 'Alice', 'Bob', 'Bob', 'Charlie', 'Charlie'],\n    'score': [85, 92, 78, 88, 95, 82]\n})\n\nprint(\"Student scores:\")\nprint(scores)\nprint()\n\n# Statistical aggregations by subject\nstats = scores.groupby('subject')['score'].agg([\n    'mean',    # Average score\n    'median',  # Middle score\n    'std',     # Standard deviation\n    'min',     # Lowest score\n    'max'      # Highest score\n])\nprint(\"Score statistics by subject:\")\nprint(stats.round(2))\n",[1154],{"type":393,"tag":423,"props":1155,"children":1156},{"__ignoreMap":6},[1157,1176,1183,1191,1207,1269,1329,1395,1402,1409,1429,1441,1452,1459,1467,1504,1522,1540,1558,1575,1588,1596,1616],{"type":393,"tag":427,"props":1158,"children":1159},{"class":429,"line":11},[1160,1164,1168,1172],{"type":393,"tag":427,"props":1161,"children":1162},{"style":433},[1163],{"type":398,"value":436},{"type":393,"tag":427,"props":1165,"children":1166},{"style":439},[1167],{"type":398,"value":442},{"type":393,"tag":427,"props":1169,"children":1170},{"style":433},[1171],{"type":398,"value":447},{"type":393,"tag":427,"props":1173,"children":1174},{"style":439},[1175],{"type":398,"value":452},{"type":393,"tag":427,"props":1177,"children":1178},{"class":429,"line":27},[1179],{"type":393,"tag":427,"props":1180,"children":1181},{"emptyLinePlaceholder":12},[1182],{"type":398,"value":460},{"type":393,"tag":427,"props":1184,"children":1185},{"class":429,"line":36},[1186],{"type":393,"tag":427,"props":1187,"children":1188},{"style":466},[1189],{"type":398,"value":1190},"# Student test scores\n",{"type":393,"tag":427,"props":1192,"children":1193},{"class":429,"line":45},[1194,1199,1203],{"type":393,"tag":427,"props":1195,"children":1196},{"style":439},[1197],{"type":398,"value":1198},"scores ",{"type":393,"tag":427,"props":1200,"children":1201},{"style":433},[1202],{"type":398,"value":482},{"type":393,"tag":427,"props":1204,"children":1205},{"style":439},[1206],{"type":398,"value":487},{"type":393,"tag":427,"props":1208,"children":1209},{"class":429,"line":54},[1210,1215,1219,1224,1228,1233,1237,1241,1245,1249,1253,1257,1261,1265],{"type":393,"tag":427,"props":1211,"children":1212},{"style":493},[1213],{"type":398,"value":1214},"    'subject'",{"type":393,"tag":427,"props":1216,"children":1217},{"style":439},[1218],{"type":398,"value":501},{"type":393,"tag":427,"props":1220,"children":1221},{"style":493},[1222],{"type":398,"value":1223},"'Math'",{"type":393,"tag":427,"props":1225,"children":1226},{"style":439},[1227],{"type":398,"value":511},{"type":393,"tag":427,"props":1229,"children":1230},{"style":493},[1231],{"type":398,"value":1232},"'Science'",{"type":393,"tag":427,"props":1234,"children":1235},{"style":439},[1236],{"type":398,"value":511},{"type":393,"tag":427,"props":1238,"children":1239},{"style":493},[1240],{"type":398,"value":1223},{"type":393,"tag":427,"props":1242,"children":1243},{"style":439},[1244],{"type":398,"value":511},{"type":393,"tag":427,"props":1246,"children":1247},{"style":493},[1248],{"type":398,"value":1232},{"type":393,"tag":427,"props":1250,"children":1251},{"style":439},[1252],{"type":398,"value":511},{"type":393,"tag":427,"props":1254,"children":1255},{"style":493},[1256],{"type":398,"value":1223},{"type":393,"tag":427,"props":1258,"children":1259},{"style":439},[1260],{"type":398,"value":511},{"type":393,"tag":427,"props":1262,"children":1263},{"style":493},[1264],{"type":398,"value":1232},{"type":393,"tag":427,"props":1266,"children":1267},{"style":439},[1268],{"type":398,"value":545},{"type":393,"tag":427,"props":1270,"children":1271},{"class":429,"line":63},[1272,1277,1281,1285,1289,1293,1297,1301,1305,1309,1313,1317,1321,1325],{"type":393,"tag":427,"props":1273,"children":1274},{"style":493},[1275],{"type":398,"value":1276},"    'student'",{"type":393,"tag":427,"props":1278,"children":1279},{"style":439},[1280],{"type":398,"value":501},{"type":393,"tag":427,"props":1282,"children":1283},{"style":493},[1284],{"type":398,"value":562},{"type":393,"tag":427,"props":1286,"children":1287},{"style":439},[1288],{"type":398,"value":511},{"type":393,"tag":427,"props":1290,"children":1291},{"style":493},[1292],{"type":398,"value":562},{"type":393,"tag":427,"props":1294,"children":1295},{"style":439},[1296],{"type":398,"value":511},{"type":393,"tag":427,"props":1298,"children":1299},{"style":493},[1300],{"type":398,"value":571},{"type":393,"tag":427,"props":1302,"children":1303},{"style":439},[1304],{"type":398,"value":511},{"type":393,"tag":427,"props":1306,"children":1307},{"style":493},[1308],{"type":398,"value":571},{"type":393,"tag":427,"props":1310,"children":1311},{"style":439},[1312],{"type":398,"value":511},{"type":393,"tag":427,"props":1314,"children":1315},{"style":493},[1316],{"type":398,"value":580},{"type":393,"tag":427,"props":1318,"children":1319},{"style":439},[1320],{"type":398,"value":511},{"type":393,"tag":427,"props":1322,"children":1323},{"style":493},[1324],{"type":398,"value":580},{"type":393,"tag":427,"props":1326,"children":1327},{"style":439},[1328],{"type":398,"value":545},{"type":393,"tag":427,"props":1330,"children":1331},{"class":429,"line":72},[1332,1337,1341,1346,1350,1355,1359,1364,1368,1373,1377,1382,1386,1391],{"type":393,"tag":427,"props":1333,"children":1334},{"style":493},[1335],{"type":398,"value":1336},"    'score'",{"type":393,"tag":427,"props":1338,"children":1339},{"style":439},[1340],{"type":398,"value":501},{"type":393,"tag":427,"props":1342,"children":1343},{"style":617},[1344],{"type":398,"value":1345},"85",{"type":393,"tag":427,"props":1347,"children":1348},{"style":439},[1349],{"type":398,"value":511},{"type":393,"tag":427,"props":1351,"children":1352},{"style":617},[1353],{"type":398,"value":1354},"92",{"type":393,"tag":427,"props":1356,"children":1357},{"style":439},[1358],{"type":398,"value":511},{"type":393,"tag":427,"props":1360,"children":1361},{"style":617},[1362],{"type":398,"value":1363},"78",{"type":393,"tag":427,"props":1365,"children":1366},{"style":439},[1367],{"type":398,"value":511},{"type":393,"tag":427,"props":1369,"children":1370},{"style":617},[1371],{"type":398,"value":1372},"88",{"type":393,"tag":427,"props":1374,"children":1375},{"style":439},[1376],{"type":398,"value":511},{"type":393,"tag":427,"props":1378,"children":1379},{"style":617},[1380],{"type":398,"value":1381},"95",{"type":393,"tag":427,"props":1383,"children":1384},{"style":439},[1385],{"type":398,"value":511},{"type":393,"tag":427,"props":1387,"children":1388},{"style":617},[1389],{"type":398,"value":1390},"82",{"type":393,"tag":427,"props":1392,"children":1393},{"style":439},[1394],{"type":398,"value":718},{"type":393,"tag":427,"props":1396,"children":1397},{"class":429,"line":83},[1398],{"type":393,"tag":427,"props":1399,"children":1400},{"style":439},[1401],{"type":398,"value":726},{"type":393,"tag":427,"props":1403,"children":1404},{"class":429,"line":92},[1405],{"type":393,"tag":427,"props":1406,"children":1407},{"emptyLinePlaceholder":12},[1408],{"type":398,"value":460},{"type":393,"tag":427,"props":1410,"children":1411},{"class":429,"line":101},[1412,1416,1420,1425],{"type":393,"tag":427,"props":1413,"children":1414},{"style":617},[1415],{"type":398,"value":741},{"type":393,"tag":427,"props":1417,"children":1418},{"style":439},[1419],{"type":398,"value":746},{"type":393,"tag":427,"props":1421,"children":1422},{"style":493},[1423],{"type":398,"value":1424},"\"Student scores:\"",{"type":393,"tag":427,"props":1426,"children":1427},{"style":439},[1428],{"type":398,"value":756},{"type":393,"tag":427,"props":1430,"children":1431},{"class":429,"line":110},[1432,1436],{"type":393,"tag":427,"props":1433,"children":1434},{"style":617},[1435],{"type":398,"value":741},{"type":393,"tag":427,"props":1437,"children":1438},{"style":439},[1439],{"type":398,"value":1440},"(scores)\n",{"type":393,"tag":427,"props":1442,"children":1443},{"class":429,"line":121},[1444,1448],{"type":393,"tag":427,"props":1445,"children":1446},{"style":617},[1447],{"type":398,"value":741},{"type":393,"tag":427,"props":1449,"children":1450},{"style":439},[1451],{"type":398,"value":780},{"type":393,"tag":427,"props":1453,"children":1454},{"class":429,"line":130},[1455],{"type":393,"tag":427,"props":1456,"children":1457},{"emptyLinePlaceholder":12},[1458],{"type":398,"value":460},{"type":393,"tag":427,"props":1460,"children":1461},{"class":429,"line":139},[1462],{"type":393,"tag":427,"props":1463,"children":1464},{"style":466},[1465],{"type":398,"value":1466},"# Statistical aggregations by subject\n",{"type":393,"tag":427,"props":1468,"children":1469},{"class":429,"line":148},[1470,1475,1479,1484,1489,1494,1499],{"type":393,"tag":427,"props":1471,"children":1472},{"style":439},[1473],{"type":398,"value":1474},"stats ",{"type":393,"tag":427,"props":1476,"children":1477},{"style":433},[1478],{"type":398,"value":482},{"type":393,"tag":427,"props":1480,"children":1481},{"style":439},[1482],{"type":398,"value":1483}," scores.groupby(",{"type":393,"tag":427,"props":1485,"children":1486},{"style":493},[1487],{"type":398,"value":1488},"'subject'",{"type":393,"tag":427,"props":1490,"children":1491},{"style":439},[1492],{"type":398,"value":1493},")[",{"type":393,"tag":427,"props":1495,"children":1496},{"style":493},[1497],{"type":398,"value":1498},"'score'",{"type":393,"tag":427,"props":1500,"children":1501},{"style":439},[1502],{"type":398,"value":1503},"].agg([\n",{"type":393,"tag":427,"props":1505,"children":1506},{"class":429,"line":159},[1507,1512,1517],{"type":393,"tag":427,"props":1508,"children":1509},{"style":493},[1510],{"type":398,"value":1511},"    'mean'",{"type":393,"tag":427,"props":1513,"children":1514},{"style":439},[1515],{"type":398,"value":1516},",    ",{"type":393,"tag":427,"props":1518,"children":1519},{"style":466},[1520],{"type":398,"value":1521},"# Average score\n",{"type":393,"tag":427,"props":1523,"children":1524},{"class":429,"line":168},[1525,1530,1535],{"type":393,"tag":427,"props":1526,"children":1527},{"style":493},[1528],{"type":398,"value":1529},"    'median'",{"type":393,"tag":427,"props":1531,"children":1532},{"style":439},[1533],{"type":398,"value":1534},",  ",{"type":393,"tag":427,"props":1536,"children":1537},{"style":466},[1538],{"type":398,"value":1539},"# Middle score\n",{"type":393,"tag":427,"props":1541,"children":1542},{"class":429,"line":177},[1543,1548,1553],{"type":393,"tag":427,"props":1544,"children":1545},{"style":493},[1546],{"type":398,"value":1547},"    'std'",{"type":393,"tag":427,"props":1549,"children":1550},{"style":439},[1551],{"type":398,"value":1552},",     ",{"type":393,"tag":427,"props":1554,"children":1555},{"style":466},[1556],{"type":398,"value":1557},"# Standard deviation\n",{"type":393,"tag":427,"props":1559,"children":1560},{"class":429,"line":186},[1561,1566,1570],{"type":393,"tag":427,"props":1562,"children":1563},{"style":493},[1564],{"type":398,"value":1565},"    'min'",{"type":393,"tag":427,"props":1567,"children":1568},{"style":439},[1569],{"type":398,"value":1552},{"type":393,"tag":427,"props":1571,"children":1572},{"style":466},[1573],{"type":398,"value":1574},"# Lowest score\n",{"type":393,"tag":427,"props":1576,"children":1577},{"class":429,"line":197},[1578,1583],{"type":393,"tag":427,"props":1579,"children":1580},{"style":493},[1581],{"type":398,"value":1582},"    'max'",{"type":393,"tag":427,"props":1584,"children":1585},{"style":466},[1586],{"type":398,"value":1587},"      # Highest score\n",{"type":393,"tag":427,"props":1589,"children":1590},{"class":429,"line":206},[1591],{"type":393,"tag":427,"props":1592,"children":1593},{"style":439},[1594],{"type":398,"value":1595},"])\n",{"type":393,"tag":427,"props":1597,"children":1598},{"class":429,"line":215},[1599,1603,1607,1612],{"type":393,"tag":427,"props":1600,"children":1601},{"style":617},[1602],{"type":398,"value":741},{"type":393,"tag":427,"props":1604,"children":1605},{"style":439},[1606],{"type":398,"value":746},{"type":393,"tag":427,"props":1608,"children":1609},{"style":493},[1610],{"type":398,"value":1611},"\"Score statistics by subject:\"",{"type":393,"tag":427,"props":1613,"children":1614},{"style":439},[1615],{"type":398,"value":756},{"type":393,"tag":427,"props":1617,"children":1618},{"class":429,"line":224},[1619,1623,1628,1633],{"type":393,"tag":427,"props":1620,"children":1621},{"style":617},[1622],{"type":398,"value":741},{"type":393,"tag":427,"props":1624,"children":1625},{"style":439},[1626],{"type":398,"value":1627},"(stats.round(",{"type":393,"tag":427,"props":1629,"children":1630},{"style":617},[1631],{"type":398,"value":1632},"2",{"type":393,"tag":427,"props":1634,"children":1635},{"style":439},[1636],{"type":398,"value":1637},"))\n",{"type":393,"tag":928,"props":1639,"children":1641},{"id":1640},"counting-and-size-functions",[1642],{"type":398,"value":1643},"🔢 Counting and Size Functions",{"type":393,"tag":401,"props":1645,"children":1646},{},[1647],{"type":398,"value":1648},"Understanding the size and frequency of your groups is crucial:",{"type":393,"tag":940,"props":1650,"children":1654},{"emoji":1651,"title":1652,"type":1653},"🔢","Counting Functions Explained","success",[1655,1663,1675,1693,1705,1723,1735],{"type":393,"tag":401,"props":1656,"children":1657},{},[1658],{"type":393,"tag":950,"props":1659,"children":1660},{},[1661],{"type":398,"value":1662},"count() vs size() vs nunique():",{"type":393,"tag":401,"props":1664,"children":1665},{},[1666],{"type":393,"tag":950,"props":1667,"children":1668},{},[1669],{"type":393,"tag":423,"props":1670,"children":1672},{"className":1671},[],[1673],{"type":398,"value":1674},".count()",{"type":393,"tag":956,"props":1676,"children":1677},{},[1678,1683,1688],{"type":393,"tag":960,"props":1679,"children":1680},{},[1681],{"type":398,"value":1682},"Counts non-null (non-missing) values",{"type":393,"tag":960,"props":1684,"children":1685},{},[1686],{"type":398,"value":1687},"Excludes NaN, None, etc.",{"type":393,"tag":960,"props":1689,"children":1690},{},[1691],{"type":398,"value":1692},"Useful for data quality checks",{"type":393,"tag":401,"props":1694,"children":1695},{},[1696],{"type":393,"tag":950,"props":1697,"children":1698},{},[1699],{"type":393,"tag":423,"props":1700,"children":1702},{"className":1701},[],[1703],{"type":398,"value":1704},".size()",{"type":393,"tag":956,"props":1706,"children":1707},{},[1708,1713,1718],{"type":393,"tag":960,"props":1709,"children":1710},{},[1711],{"type":398,"value":1712},"Counts all rows in each group",{"type":393,"tag":960,"props":1714,"children":1715},{},[1716],{"type":398,"value":1717},"Includes null values",{"type":393,"tag":960,"props":1719,"children":1720},{},[1721],{"type":398,"value":1722},"Shows actual group sizes",{"type":393,"tag":401,"props":1724,"children":1725},{},[1726],{"type":393,"tag":950,"props":1727,"children":1728},{},[1729],{"type":393,"tag":423,"props":1730,"children":1732},{"className":1731},[],[1733],{"type":398,"value":1734},".nunique()",{"type":393,"tag":956,"props":1736,"children":1737},{},[1738,1743,1748],{"type":393,"tag":960,"props":1739,"children":1740},{},[1741],{"type":398,"value":1742},"Counts unique/distinct values",{"type":393,"tag":960,"props":1744,"children":1745},{},[1746],{"type":398,"value":1747},"Useful for diversity analysis",{"type":393,"tag":960,"props":1749,"children":1750},{},[1751],{"type":398,"value":1752},"Example: How many different products per customer?",{"type":393,"tag":412,"props":1754,"children":1755},{},[1756],{"type":393,"tag":416,"props":1757,"children":1759},{"className":418,"code":1758,"language":420,"meta":6,"style":6},"import pandas as pd\nimport numpy as np\n\n# Customer orders with some missing data\norders = pd.DataFrame({\n    'customer': ['Alice', 'Alice', 'Bob', 'Bob', 'Charlie', 'Charlie'],\n    'product': ['Laptop', 'Mouse', 'Laptop', np.nan, 'Keyboard', 'Monitor'],\n    'amount': [999, 25, 999, np.nan, 75, 300]\n})\n\nprint(\"Orders (with missing data):\")\nprint(orders)\nprint()\n\n# Different counting methods\nprint(\"Count comparison:\")\nprint(\"Non-null products per customer:\", orders.groupby('customer')['product'].count())\nprint(\"Total orders per customer:\", orders.groupby('customer').size())\nprint(\"Unique products per customer:\", orders.groupby('customer')['product'].nunique())\n",[1760],{"type":393,"tag":423,"props":1761,"children":1762},{"__ignoreMap":6},[1763,1782,1803,1810,1818,1834,1894,1951,2007,2014,2021,2041,2053,2064,2071,2079,2099,2139,2168],{"type":393,"tag":427,"props":1764,"children":1765},{"class":429,"line":11},[1766,1770,1774,1778],{"type":393,"tag":427,"props":1767,"children":1768},{"style":433},[1769],{"type":398,"value":436},{"type":393,"tag":427,"props":1771,"children":1772},{"style":439},[1773],{"type":398,"value":442},{"type":393,"tag":427,"props":1775,"children":1776},{"style":433},[1777],{"type":398,"value":447},{"type":393,"tag":427,"props":1779,"children":1780},{"style":439},[1781],{"type":398,"value":452},{"type":393,"tag":427,"props":1783,"children":1784},{"class":429,"line":27},[1785,1789,1794,1798],{"type":393,"tag":427,"props":1786,"children":1787},{"style":433},[1788],{"type":398,"value":436},{"type":393,"tag":427,"props":1790,"children":1791},{"style":439},[1792],{"type":398,"value":1793}," numpy ",{"type":393,"tag":427,"props":1795,"children":1796},{"style":433},[1797],{"type":398,"value":447},{"type":393,"tag":427,"props":1799,"children":1800},{"style":439},[1801],{"type":398,"value":1802}," np\n",{"type":393,"tag":427,"props":1804,"children":1805},{"class":429,"line":36},[1806],{"type":393,"tag":427,"props":1807,"children":1808},{"emptyLinePlaceholder":12},[1809],{"type":398,"value":460},{"type":393,"tag":427,"props":1811,"children":1812},{"class":429,"line":45},[1813],{"type":393,"tag":427,"props":1814,"children":1815},{"style":466},[1816],{"type":398,"value":1817},"# Customer orders with some missing data\n",{"type":393,"tag":427,"props":1819,"children":1820},{"class":429,"line":54},[1821,1826,1830],{"type":393,"tag":427,"props":1822,"children":1823},{"style":439},[1824],{"type":398,"value":1825},"orders ",{"type":393,"tag":427,"props":1827,"children":1828},{"style":433},[1829],{"type":398,"value":482},{"type":393,"tag":427,"props":1831,"children":1832},{"style":439},[1833],{"type":398,"value":487},{"type":393,"tag":427,"props":1835,"children":1836},{"class":429,"line":63},[1837,1842,1846,1850,1854,1858,1862,1866,1870,1874,1878,1882,1886,1890],{"type":393,"tag":427,"props":1838,"children":1839},{"style":493},[1840],{"type":398,"value":1841},"    'customer'",{"type":393,"tag":427,"props":1843,"children":1844},{"style":439},[1845],{"type":398,"value":501},{"type":393,"tag":427,"props":1847,"children":1848},{"style":493},[1849],{"type":398,"value":562},{"type":393,"tag":427,"props":1851,"children":1852},{"style":439},[1853],{"type":398,"value":511},{"type":393,"tag":427,"props":1855,"children":1856},{"style":493},[1857],{"type":398,"value":562},{"type":393,"tag":427,"props":1859,"children":1860},{"style":439},[1861],{"type":398,"value":511},{"type":393,"tag":427,"props":1863,"children":1864},{"style":493},[1865],{"type":398,"value":571},{"type":393,"tag":427,"props":1867,"children":1868},{"style":439},[1869],{"type":398,"value":511},{"type":393,"tag":427,"props":1871,"children":1872},{"style":493},[1873],{"type":398,"value":571},{"type":393,"tag":427,"props":1875,"children":1876},{"style":439},[1877],{"type":398,"value":511},{"type":393,"tag":427,"props":1879,"children":1880},{"style":493},[1881],{"type":398,"value":580},{"type":393,"tag":427,"props":1883,"children":1884},{"style":439},[1885],{"type":398,"value":511},{"type":393,"tag":427,"props":1887,"children":1888},{"style":493},[1889],{"type":398,"value":580},{"type":393,"tag":427,"props":1891,"children":1892},{"style":439},[1893],{"type":398,"value":545},{"type":393,"tag":427,"props":1895,"children":1896},{"class":429,"line":72},[1897,1902,1906,1911,1915,1920,1924,1928,1933,1938,1942,1947],{"type":393,"tag":427,"props":1898,"children":1899},{"style":493},[1900],{"type":398,"value":1901},"    'product'",{"type":393,"tag":427,"props":1903,"children":1904},{"style":439},[1905],{"type":398,"value":501},{"type":393,"tag":427,"props":1907,"children":1908},{"style":493},[1909],{"type":398,"value":1910},"'Laptop'",{"type":393,"tag":427,"props":1912,"children":1913},{"style":439},[1914],{"type":398,"value":511},{"type":393,"tag":427,"props":1916,"children":1917},{"style":493},[1918],{"type":398,"value":1919},"'Mouse'",{"type":393,"tag":427,"props":1921,"children":1922},{"style":439},[1923],{"type":398,"value":511},{"type":393,"tag":427,"props":1925,"children":1926},{"style":493},[1927],{"type":398,"value":1910},{"type":393,"tag":427,"props":1929,"children":1930},{"style":439},[1931],{"type":398,"value":1932},", np.nan, ",{"type":393,"tag":427,"props":1934,"children":1935},{"style":493},[1936],{"type":398,"value":1937},"'Keyboard'",{"type":393,"tag":427,"props":1939,"children":1940},{"style":439},[1941],{"type":398,"value":511},{"type":393,"tag":427,"props":1943,"children":1944},{"style":493},[1945],{"type":398,"value":1946},"'Monitor'",{"type":393,"tag":427,"props":1948,"children":1949},{"style":439},[1950],{"type":398,"value":545},{"type":393,"tag":427,"props":1952,"children":1953},{"class":429,"line":83},[1954,1959,1963,1968,1972,1977,1981,1985,1989,1994,1998,2003],{"type":393,"tag":427,"props":1955,"children":1956},{"style":493},[1957],{"type":398,"value":1958},"    'amount'",{"type":393,"tag":427,"props":1960,"children":1961},{"style":439},[1962],{"type":398,"value":501},{"type":393,"tag":427,"props":1964,"children":1965},{"style":617},[1966],{"type":398,"value":1967},"999",{"type":393,"tag":427,"props":1969,"children":1970},{"style":439},[1971],{"type":398,"value":511},{"type":393,"tag":427,"props":1973,"children":1974},{"style":617},[1975],{"type":398,"value":1976},"25",{"type":393,"tag":427,"props":1978,"children":1979},{"style":439},[1980],{"type":398,"value":511},{"type":393,"tag":427,"props":1982,"children":1983},{"style":617},[1984],{"type":398,"value":1967},{"type":393,"tag":427,"props":1986,"children":1987},{"style":439},[1988],{"type":398,"value":1932},{"type":393,"tag":427,"props":1990,"children":1991},{"style":617},[1992],{"type":398,"value":1993},"75",{"type":393,"tag":427,"props":1995,"children":1996},{"style":439},[1997],{"type":398,"value":511},{"type":393,"tag":427,"props":1999,"children":2000},{"style":617},[2001],{"type":398,"value":2002},"300",{"type":393,"tag":427,"props":2004,"children":2005},{"style":439},[2006],{"type":398,"value":718},{"type":393,"tag":427,"props":2008,"children":2009},{"class":429,"line":92},[2010],{"type":393,"tag":427,"props":2011,"children":2012},{"style":439},[2013],{"type":398,"value":726},{"type":393,"tag":427,"props":2015,"children":2016},{"class":429,"line":101},[2017],{"type":393,"tag":427,"props":2018,"children":2019},{"emptyLinePlaceholder":12},[2020],{"type":398,"value":460},{"type":393,"tag":427,"props":2022,"children":2023},{"class":429,"line":110},[2024,2028,2032,2037],{"type":393,"tag":427,"props":2025,"children":2026},{"style":617},[2027],{"type":398,"value":741},{"type":393,"tag":427,"props":2029,"children":2030},{"style":439},[2031],{"type":398,"value":746},{"type":393,"tag":427,"props":2033,"children":2034},{"style":493},[2035],{"type":398,"value":2036},"\"Orders (with missing data):\"",{"type":393,"tag":427,"props":2038,"children":2039},{"style":439},[2040],{"type":398,"value":756},{"type":393,"tag":427,"props":2042,"children":2043},{"class":429,"line":121},[2044,2048],{"type":393,"tag":427,"props":2045,"children":2046},{"style":617},[2047],{"type":398,"value":741},{"type":393,"tag":427,"props":2049,"children":2050},{"style":439},[2051],{"type":398,"value":2052},"(orders)\n",{"type":393,"tag":427,"props":2054,"children":2055},{"class":429,"line":130},[2056,2060],{"type":393,"tag":427,"props":2057,"children":2058},{"style":617},[2059],{"type":398,"value":741},{"type":393,"tag":427,"props":2061,"children":2062},{"style":439},[2063],{"type":398,"value":780},{"type":393,"tag":427,"props":2065,"children":2066},{"class":429,"line":139},[2067],{"type":393,"tag":427,"props":2068,"children":2069},{"emptyLinePlaceholder":12},[2070],{"type":398,"value":460},{"type":393,"tag":427,"props":2072,"children":2073},{"class":429,"line":148},[2074],{"type":393,"tag":427,"props":2075,"children":2076},{"style":466},[2077],{"type":398,"value":2078},"# Different counting methods\n",{"type":393,"tag":427,"props":2080,"children":2081},{"class":429,"line":159},[2082,2086,2090,2095],{"type":393,"tag":427,"props":2083,"children":2084},{"style":617},[2085],{"type":398,"value":741},{"type":393,"tag":427,"props":2087,"children":2088},{"style":439},[2089],{"type":398,"value":746},{"type":393,"tag":427,"props":2091,"children":2092},{"style":493},[2093],{"type":398,"value":2094},"\"Count comparison:\"",{"type":393,"tag":427,"props":2096,"children":2097},{"style":439},[2098],{"type":398,"value":756},{"type":393,"tag":427,"props":2100,"children":2101},{"class":429,"line":168},[2102,2106,2110,2115,2120,2125,2129,2134],{"type":393,"tag":427,"props":2103,"children":2104},{"style":617},[2105],{"type":398,"value":741},{"type":393,"tag":427,"props":2107,"children":2108},{"style":439},[2109],{"type":398,"value":746},{"type":393,"tag":427,"props":2111,"children":2112},{"style":493},[2113],{"type":398,"value":2114},"\"Non-null products per customer:\"",{"type":393,"tag":427,"props":2116,"children":2117},{"style":439},[2118],{"type":398,"value":2119},", orders.groupby(",{"type":393,"tag":427,"props":2121,"children":2122},{"style":493},[2123],{"type":398,"value":2124},"'customer'",{"type":393,"tag":427,"props":2126,"children":2127},{"style":439},[2128],{"type":398,"value":1493},{"type":393,"tag":427,"props":2130,"children":2131},{"style":493},[2132],{"type":398,"value":2133},"'product'",{"type":393,"tag":427,"props":2135,"children":2136},{"style":439},[2137],{"type":398,"value":2138},"].count())\n",{"type":393,"tag":427,"props":2140,"children":2141},{"class":429,"line":177},[2142,2146,2150,2155,2159,2163],{"type":393,"tag":427,"props":2143,"children":2144},{"style":617},[2145],{"type":398,"value":741},{"type":393,"tag":427,"props":2147,"children":2148},{"style":439},[2149],{"type":398,"value":746},{"type":393,"tag":427,"props":2151,"children":2152},{"style":493},[2153],{"type":398,"value":2154},"\"Total orders per customer:\"",{"type":393,"tag":427,"props":2156,"children":2157},{"style":439},[2158],{"type":398,"value":2119},{"type":393,"tag":427,"props":2160,"children":2161},{"style":493},[2162],{"type":398,"value":2124},{"type":393,"tag":427,"props":2164,"children":2165},{"style":439},[2166],{"type":398,"value":2167},").size())\n",{"type":393,"tag":427,"props":2169,"children":2170},{"class":429,"line":186},[2171,2175,2179,2184,2188,2192,2196,2200],{"type":393,"tag":427,"props":2172,"children":2173},{"style":617},[2174],{"type":398,"value":741},{"type":393,"tag":427,"props":2176,"children":2177},{"style":439},[2178],{"type":398,"value":746},{"type":393,"tag":427,"props":2180,"children":2181},{"style":493},[2182],{"type":398,"value":2183},"\"Unique products per customer:\"",{"type":393,"tag":427,"props":2185,"children":2186},{"style":439},[2187],{"type":398,"value":2119},{"type":393,"tag":427,"props":2189,"children":2190},{"style":493},[2191],{"type":398,"value":2124},{"type":393,"tag":427,"props":2193,"children":2194},{"style":439},[2195],{"type":398,"value":1493},{"type":393,"tag":427,"props":2197,"children":2198},{"style":493},[2199],{"type":398,"value":2133},{"type":393,"tag":427,"props":2201,"children":2202},{"style":439},[2203],{"type":398,"value":2204},"].nunique())\n",{"type":393,"tag":928,"props":2206,"children":2208},{"id":2207},"custom-aggregation-functions",[2209],{"type":398,"value":2210},"🎨 Custom Aggregation Functions",{"type":393,"tag":401,"props":2212,"children":2213},{},[2214],{"type":398,"value":2215},"You can create your own aggregation functions for specific business logic:",{"type":393,"tag":412,"props":2217,"children":2218},{},[2219],{"type":393,"tag":416,"props":2220,"children":2222},{"className":418,"code":2221,"language":420,"meta":6,"style":6},"import pandas as pd\n\ndef price_range(prices):\n    \"\"\"Calculate the range between max and min prices\"\"\"\n    return prices.max() - prices.min()\n\ndef top_product(products):\n    \"\"\"Find the most frequent product\"\"\"\n    return products.mode().iloc[0] if len(products.mode()) > 0 else 'None'\n\n# Product sales data\nsales = pd.DataFrame({\n    'category': ['Electronics', 'Books', 'Electronics', 'Books', 'Electronics'],\n    'product': ['Laptop', 'Novel', 'Mouse', 'Textbook', 'Laptop'],\n    'price': [999, 15, 25, 85, 899]\n})\n\nprint(\"Sales data:\")\nprint(sales)\nprint()\n\n# Apply custom functions\ncustom_agg = sales.groupby('category').agg({\n    'price': ['mean', price_range],\n    'product': [top_product, 'count']\n})\nprint(\"Custom aggregations:\")\nprint(custom_agg)\n",[2223],{"type":393,"tag":423,"props":2224,"children":2225},{"__ignoreMap":6},[2226,2245,2252,2271,2279,2302,2309,2326,2334,2391,2398,2406,2422,2476,2529,2583,2590,2597,2617,2629,2640,2647,2655,2681,2701,2722,2729,2749],{"type":393,"tag":427,"props":2227,"children":2228},{"class":429,"line":11},[2229,2233,2237,2241],{"type":393,"tag":427,"props":2230,"children":2231},{"style":433},[2232],{"type":398,"value":436},{"type":393,"tag":427,"props":2234,"children":2235},{"style":439},[2236],{"type":398,"value":442},{"type":393,"tag":427,"props":2238,"children":2239},{"style":433},[2240],{"type":398,"value":447},{"type":393,"tag":427,"props":2242,"children":2243},{"style":439},[2244],{"type":398,"value":452},{"type":393,"tag":427,"props":2246,"children":2247},{"class":429,"line":27},[2248],{"type":393,"tag":427,"props":2249,"children":2250},{"emptyLinePlaceholder":12},[2251],{"type":398,"value":460},{"type":393,"tag":427,"props":2253,"children":2254},{"class":429,"line":36},[2255,2260,2266],{"type":393,"tag":427,"props":2256,"children":2257},{"style":433},[2258],{"type":398,"value":2259},"def",{"type":393,"tag":427,"props":2261,"children":2263},{"style":2262},"--shiki-default:#6F42C1;--shiki-app-dark-mode:#B392F0",[2264],{"type":398,"value":2265}," price_range",{"type":393,"tag":427,"props":2267,"children":2268},{"style":439},[2269],{"type":398,"value":2270},"(prices):\n",{"type":393,"tag":427,"props":2272,"children":2273},{"class":429,"line":45},[2274],{"type":393,"tag":427,"props":2275,"children":2276},{"style":493},[2277],{"type":398,"value":2278},"    \"\"\"Calculate the range between max and min prices\"\"\"\n",{"type":393,"tag":427,"props":2280,"children":2281},{"class":429,"line":54},[2282,2287,2292,2297],{"type":393,"tag":427,"props":2283,"children":2284},{"style":433},[2285],{"type":398,"value":2286},"    return",{"type":393,"tag":427,"props":2288,"children":2289},{"style":439},[2290],{"type":398,"value":2291}," prices.max() ",{"type":393,"tag":427,"props":2293,"children":2294},{"style":433},[2295],{"type":398,"value":2296},"-",{"type":393,"tag":427,"props":2298,"children":2299},{"style":439},[2300],{"type":398,"value":2301}," prices.min()\n",{"type":393,"tag":427,"props":2303,"children":2304},{"class":429,"line":63},[2305],{"type":393,"tag":427,"props":2306,"children":2307},{"emptyLinePlaceholder":12},[2308],{"type":398,"value":460},{"type":393,"tag":427,"props":2310,"children":2311},{"class":429,"line":72},[2312,2316,2321],{"type":393,"tag":427,"props":2313,"children":2314},{"style":433},[2315],{"type":398,"value":2259},{"type":393,"tag":427,"props":2317,"children":2318},{"style":2262},[2319],{"type":398,"value":2320}," top_product",{"type":393,"tag":427,"props":2322,"children":2323},{"style":439},[2324],{"type":398,"value":2325},"(products):\n",{"type":393,"tag":427,"props":2327,"children":2328},{"class":429,"line":83},[2329],{"type":393,"tag":427,"props":2330,"children":2331},{"style":493},[2332],{"type":398,"value":2333},"    \"\"\"Find the most frequent product\"\"\"\n",{"type":393,"tag":427,"props":2335,"children":2336},{"class":429,"line":92},[2337,2341,2346,2351,2356,2361,2366,2371,2376,2381,2386],{"type":393,"tag":427,"props":2338,"children":2339},{"style":433},[2340],{"type":398,"value":2286},{"type":393,"tag":427,"props":2342,"children":2343},{"style":439},[2344],{"type":398,"value":2345}," products.mode().iloc[",{"type":393,"tag":427,"props":2347,"children":2348},{"style":617},[2349],{"type":398,"value":2350},"0",{"type":393,"tag":427,"props":2352,"children":2353},{"style":439},[2354],{"type":398,"value":2355},"] ",{"type":393,"tag":427,"props":2357,"children":2358},{"style":433},[2359],{"type":398,"value":2360},"if",{"type":393,"tag":427,"props":2362,"children":2363},{"style":617},[2364],{"type":398,"value":2365}," len",{"type":393,"tag":427,"props":2367,"children":2368},{"style":439},[2369],{"type":398,"value":2370},"(products.mode()) ",{"type":393,"tag":427,"props":2372,"children":2373},{"style":433},[2374],{"type":398,"value":2375},">",{"type":393,"tag":427,"props":2377,"children":2378},{"style":617},[2379],{"type":398,"value":2380}," 0",{"type":393,"tag":427,"props":2382,"children":2383},{"style":433},[2384],{"type":398,"value":2385}," else",{"type":393,"tag":427,"props":2387,"children":2388},{"style":493},[2389],{"type":398,"value":2390}," 'None'\n",{"type":393,"tag":427,"props":2392,"children":2393},{"class":429,"line":101},[2394],{"type":393,"tag":427,"props":2395,"children":2396},{"emptyLinePlaceholder":12},[2397],{"type":398,"value":460},{"type":393,"tag":427,"props":2399,"children":2400},{"class":429,"line":110},[2401],{"type":393,"tag":427,"props":2402,"children":2403},{"style":466},[2404],{"type":398,"value":2405},"# Product sales data\n",{"type":393,"tag":427,"props":2407,"children":2408},{"class":429,"line":121},[2409,2414,2418],{"type":393,"tag":427,"props":2410,"children":2411},{"style":439},[2412],{"type":398,"value":2413},"sales ",{"type":393,"tag":427,"props":2415,"children":2416},{"style":433},[2417],{"type":398,"value":482},{"type":393,"tag":427,"props":2419,"children":2420},{"style":439},[2421],{"type":398,"value":487},{"type":393,"tag":427,"props":2423,"children":2424},{"class":429,"line":130},[2425,2430,2434,2439,2443,2448,2452,2456,2460,2464,2468,2472],{"type":393,"tag":427,"props":2426,"children":2427},{"style":493},[2428],{"type":398,"value":2429},"    'category'",{"type":393,"tag":427,"props":2431,"children":2432},{"style":439},[2433],{"type":398,"value":501},{"type":393,"tag":427,"props":2435,"children":2436},{"style":493},[2437],{"type":398,"value":2438},"'Electronics'",{"type":393,"tag":427,"props":2440,"children":2441},{"style":439},[2442],{"type":398,"value":511},{"type":393,"tag":427,"props":2444,"children":2445},{"style":493},[2446],{"type":398,"value":2447},"'Books'",{"type":393,"tag":427,"props":2449,"children":2450},{"style":439},[2451],{"type":398,"value":511},{"type":393,"tag":427,"props":2453,"children":2454},{"style":493},[2455],{"type":398,"value":2438},{"type":393,"tag":427,"props":2457,"children":2458},{"style":439},[2459],{"type":398,"value":511},{"type":393,"tag":427,"props":2461,"children":2462},{"style":493},[2463],{"type":398,"value":2447},{"type":393,"tag":427,"props":2465,"children":2466},{"style":439},[2467],{"type":398,"value":511},{"type":393,"tag":427,"props":2469,"children":2470},{"style":493},[2471],{"type":398,"value":2438},{"type":393,"tag":427,"props":2473,"children":2474},{"style":439},[2475],{"type":398,"value":545},{"type":393,"tag":427,"props":2477,"children":2478},{"class":429,"line":139},[2479,2483,2487,2491,2495,2500,2504,2508,2512,2517,2521,2525],{"type":393,"tag":427,"props":2480,"children":2481},{"style":493},[2482],{"type":398,"value":1901},{"type":393,"tag":427,"props":2484,"children":2485},{"style":439},[2486],{"type":398,"value":501},{"type":393,"tag":427,"props":2488,"children":2489},{"style":493},[2490],{"type":398,"value":1910},{"type":393,"tag":427,"props":2492,"children":2493},{"style":439},[2494],{"type":398,"value":511},{"type":393,"tag":427,"props":2496,"children":2497},{"style":493},[2498],{"type":398,"value":2499},"'Novel'",{"type":393,"tag":427,"props":2501,"children":2502},{"style":439},[2503],{"type":398,"value":511},{"type":393,"tag":427,"props":2505,"children":2506},{"style":493},[2507],{"type":398,"value":1919},{"type":393,"tag":427,"props":2509,"children":2510},{"style":439},[2511],{"type":398,"value":511},{"type":393,"tag":427,"props":2513,"children":2514},{"style":493},[2515],{"type":398,"value":2516},"'Textbook'",{"type":393,"tag":427,"props":2518,"children":2519},{"style":439},[2520],{"type":398,"value":511},{"type":393,"tag":427,"props":2522,"children":2523},{"style":493},[2524],{"type":398,"value":1910},{"type":393,"tag":427,"props":2526,"children":2527},{"style":439},[2528],{"type":398,"value":545},{"type":393,"tag":427,"props":2530,"children":2531},{"class":429,"line":148},[2532,2537,2541,2545,2549,2554,2558,2562,2566,2570,2574,2579],{"type":393,"tag":427,"props":2533,"children":2534},{"style":493},[2535],{"type":398,"value":2536},"    'price'",{"type":393,"tag":427,"props":2538,"children":2539},{"style":439},[2540],{"type":398,"value":501},{"type":393,"tag":427,"props":2542,"children":2543},{"style":617},[2544],{"type":398,"value":1967},{"type":393,"tag":427,"props":2546,"children":2547},{"style":439},[2548],{"type":398,"value":511},{"type":393,"tag":427,"props":2550,"children":2551},{"style":617},[2552],{"type":398,"value":2553},"15",{"type":393,"tag":427,"props":2555,"children":2556},{"style":439},[2557],{"type":398,"value":511},{"type":393,"tag":427,"props":2559,"children":2560},{"style":617},[2561],{"type":398,"value":1976},{"type":393,"tag":427,"props":2563,"children":2564},{"style":439},[2565],{"type":398,"value":511},{"type":393,"tag":427,"props":2567,"children":2568},{"style":617},[2569],{"type":398,"value":1345},{"type":393,"tag":427,"props":2571,"children":2572},{"style":439},[2573],{"type":398,"value":511},{"type":393,"tag":427,"props":2575,"children":2576},{"style":617},[2577],{"type":398,"value":2578},"899",{"type":393,"tag":427,"props":2580,"children":2581},{"style":439},[2582],{"type":398,"value":718},{"type":393,"tag":427,"props":2584,"children":2585},{"class":429,"line":159},[2586],{"type":393,"tag":427,"props":2587,"children":2588},{"style":439},[2589],{"type":398,"value":726},{"type":393,"tag":427,"props":2591,"children":2592},{"class":429,"line":168},[2593],{"type":393,"tag":427,"props":2594,"children":2595},{"emptyLinePlaceholder":12},[2596],{"type":398,"value":460},{"type":393,"tag":427,"props":2598,"children":2599},{"class":429,"line":177},[2600,2604,2608,2613],{"type":393,"tag":427,"props":2601,"children":2602},{"style":617},[2603],{"type":398,"value":741},{"type":393,"tag":427,"props":2605,"children":2606},{"style":439},[2607],{"type":398,"value":746},{"type":393,"tag":427,"props":2609,"children":2610},{"style":493},[2611],{"type":398,"value":2612},"\"Sales data:\"",{"type":393,"tag":427,"props":2614,"children":2615},{"style":439},[2616],{"type":398,"value":756},{"type":393,"tag":427,"props":2618,"children":2619},{"class":429,"line":186},[2620,2624],{"type":393,"tag":427,"props":2621,"children":2622},{"style":617},[2623],{"type":398,"value":741},{"type":393,"tag":427,"props":2625,"children":2626},{"style":439},[2627],{"type":398,"value":2628},"(sales)\n",{"type":393,"tag":427,"props":2630,"children":2631},{"class":429,"line":197},[2632,2636],{"type":393,"tag":427,"props":2633,"children":2634},{"style":617},[2635],{"type":398,"value":741},{"type":393,"tag":427,"props":2637,"children":2638},{"style":439},[2639],{"type":398,"value":780},{"type":393,"tag":427,"props":2641,"children":2642},{"class":429,"line":206},[2643],{"type":393,"tag":427,"props":2644,"children":2645},{"emptyLinePlaceholder":12},[2646],{"type":398,"value":460},{"type":393,"tag":427,"props":2648,"children":2649},{"class":429,"line":215},[2650],{"type":393,"tag":427,"props":2651,"children":2652},{"style":466},[2653],{"type":398,"value":2654},"# Apply custom functions\n",{"type":393,"tag":427,"props":2656,"children":2657},{"class":429,"line":224},[2658,2663,2667,2672,2677],{"type":393,"tag":427,"props":2659,"children":2660},{"style":439},[2661],{"type":398,"value":2662},"custom_agg ",{"type":393,"tag":427,"props":2664,"children":2665},{"style":433},[2666],{"type":398,"value":482},{"type":393,"tag":427,"props":2668,"children":2669},{"style":439},[2670],{"type":398,"value":2671}," sales.groupby(",{"type":393,"tag":427,"props":2673,"children":2674},{"style":493},[2675],{"type":398,"value":2676},"'category'",{"type":393,"tag":427,"props":2678,"children":2679},{"style":439},[2680],{"type":398,"value":822},{"type":393,"tag":427,"props":2682,"children":2683},{"class":429,"line":233},[2684,2688,2692,2696],{"type":393,"tag":427,"props":2685,"children":2686},{"style":493},[2687],{"type":398,"value":2536},{"type":393,"tag":427,"props":2689,"children":2690},{"style":439},[2691],{"type":398,"value":501},{"type":393,"tag":427,"props":2693,"children":2694},{"style":493},[2695],{"type":398,"value":847},{"type":393,"tag":427,"props":2697,"children":2698},{"style":439},[2699],{"type":398,"value":2700},", price_range],\n",{"type":393,"tag":427,"props":2702,"children":2703},{"class":429,"line":244},[2704,2708,2713,2718],{"type":393,"tag":427,"props":2705,"children":2706},{"style":493},[2707],{"type":398,"value":1901},{"type":393,"tag":427,"props":2709,"children":2710},{"style":439},[2711],{"type":398,"value":2712},": [top_product, ",{"type":393,"tag":427,"props":2714,"children":2715},{"style":493},[2716],{"type":398,"value":2717},"'count'",{"type":393,"tag":427,"props":2719,"children":2720},{"style":439},[2721],{"type":398,"value":718},{"type":393,"tag":427,"props":2723,"children":2724},{"class":429,"line":253},[2725],{"type":393,"tag":427,"props":2726,"children":2727},{"style":439},[2728],{"type":398,"value":726},{"type":393,"tag":427,"props":2730,"children":2731},{"class":429,"line":262},[2732,2736,2740,2745],{"type":393,"tag":427,"props":2733,"children":2734},{"style":617},[2735],{"type":398,"value":741},{"type":393,"tag":427,"props":2737,"children":2738},{"style":439},[2739],{"type":398,"value":746},{"type":393,"tag":427,"props":2741,"children":2742},{"style":493},[2743],{"type":398,"value":2744},"\"Custom aggregations:\"",{"type":393,"tag":427,"props":2746,"children":2747},{"style":439},[2748],{"type":398,"value":756},{"type":393,"tag":427,"props":2750,"children":2751},{"class":429,"line":271},[2752,2756],{"type":393,"tag":427,"props":2753,"children":2754},{"style":617},[2755],{"type":398,"value":741},{"type":393,"tag":427,"props":2757,"children":2758},{"style":439},[2759],{"type":398,"value":2760},"(custom_agg)\n",{"type":393,"tag":928,"props":2762,"children":2764},{"id":2763},"multiple-aggregations-with-different-names",[2765],{"type":398,"value":2766},"📋 Multiple Aggregations with Different Names",{"type":393,"tag":401,"props":2768,"children":2769},{},[2770],{"type":398,"value":2771},"You can rename aggregation results for clarity:",{"type":393,"tag":412,"props":2773,"children":2774},{},[2775],{"type":393,"tag":416,"props":2776,"children":2778},{"className":418,"code":2777,"language":420,"meta":6,"style":6},"import pandas as pd\n\n# Employee performance data\nperformance = pd.DataFrame({\n    'department': ['Sales', 'IT', 'Sales', 'IT', 'HR', 'HR'],\n    'employee': ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank'],\n    'rating': [4.5, 4.8, 4.2, 4.6, 4.0, 4.3],\n    'projects': [8, 12, 6, 15, 4, 5]\n})\n\nprint(\"Performance data:\")\nprint(performance)\nprint()\n\n# Named aggregations for clarity\nsummary = performance.groupby('department').agg(\n    avg_rating=('rating', 'mean'),\n    max_rating=('rating', 'max'),\n    total_projects=('projects', 'sum'),\n    team_size=('employee', 'count')\n).round(2)\n\nprint(\"Department summary:\")\nprint(summary)\n",[2779],{"type":393,"tag":423,"props":2780,"children":2781},{"__ignoreMap":6},[2782,2801,2808,2816,2832,2895,2956,3022,3087,3094,3101,3121,3133,3144,3151,3159,3185,3220,3252,3285,3318,3334,3341,3361],{"type":393,"tag":427,"props":2783,"children":2784},{"class":429,"line":11},[2785,2789,2793,2797],{"type":393,"tag":427,"props":2786,"children":2787},{"style":433},[2788],{"type":398,"value":436},{"type":393,"tag":427,"props":2790,"children":2791},{"style":439},[2792],{"type":398,"value":442},{"type":393,"tag":427,"props":2794,"children":2795},{"style":433},[2796],{"type":398,"value":447},{"type":393,"tag":427,"props":2798,"children":2799},{"style":439},[2800],{"type":398,"value":452},{"type":393,"tag":427,"props":2802,"children":2803},{"class":429,"line":27},[2804],{"type":393,"tag":427,"props":2805,"children":2806},{"emptyLinePlaceholder":12},[2807],{"type":398,"value":460},{"type":393,"tag":427,"props":2809,"children":2810},{"class":429,"line":36},[2811],{"type":393,"tag":427,"props":2812,"children":2813},{"style":466},[2814],{"type":398,"value":2815},"# Employee performance data\n",{"type":393,"tag":427,"props":2817,"children":2818},{"class":429,"line":45},[2819,2824,2828],{"type":393,"tag":427,"props":2820,"children":2821},{"style":439},[2822],{"type":398,"value":2823},"performance ",{"type":393,"tag":427,"props":2825,"children":2826},{"style":433},[2827],{"type":398,"value":482},{"type":393,"tag":427,"props":2829,"children":2830},{"style":439},[2831],{"type":398,"value":487},{"type":393,"tag":427,"props":2833,"children":2834},{"class":429,"line":54},[2835,2840,2844,2849,2853,2858,2862,2866,2870,2874,2878,2883,2887,2891],{"type":393,"tag":427,"props":2836,"children":2837},{"style":493},[2838],{"type":398,"value":2839},"    'department'",{"type":393,"tag":427,"props":2841,"children":2842},{"style":439},[2843],{"type":398,"value":501},{"type":393,"tag":427,"props":2845,"children":2846},{"style":493},[2847],{"type":398,"value":2848},"'Sales'",{"type":393,"tag":427,"props":2850,"children":2851},{"style":439},[2852],{"type":398,"value":511},{"type":393,"tag":427,"props":2854,"children":2855},{"style":493},[2856],{"type":398,"value":2857},"'IT'",{"type":393,"tag":427,"props":2859,"children":2860},{"style":439},[2861],{"type":398,"value":511},{"type":393,"tag":427,"props":2863,"children":2864},{"style":493},[2865],{"type":398,"value":2848},{"type":393,"tag":427,"props":2867,"children":2868},{"style":439},[2869],{"type":398,"value":511},{"type":393,"tag":427,"props":2871,"children":2872},{"style":493},[2873],{"type":398,"value":2857},{"type":393,"tag":427,"props":2875,"children":2876},{"style":439},[2877],{"type":398,"value":511},{"type":393,"tag":427,"props":2879,"children":2880},{"style":493},[2881],{"type":398,"value":2882},"'HR'",{"type":393,"tag":427,"props":2884,"children":2885},{"style":439},[2886],{"type":398,"value":511},{"type":393,"tag":427,"props":2888,"children":2889},{"style":493},[2890],{"type":398,"value":2882},{"type":393,"tag":427,"props":2892,"children":2893},{"style":439},[2894],{"type":398,"value":545},{"type":393,"tag":427,"props":2896,"children":2897},{"class":429,"line":63},[2898,2903,2907,2911,2915,2919,2923,2927,2931,2935,2939,2943,2947,2952],{"type":393,"tag":427,"props":2899,"children":2900},{"style":493},[2901],{"type":398,"value":2902},"    'employee'",{"type":393,"tag":427,"props":2904,"children":2905},{"style":439},[2906],{"type":398,"value":501},{"type":393,"tag":427,"props":2908,"children":2909},{"style":493},[2910],{"type":398,"value":562},{"type":393,"tag":427,"props":2912,"children":2913},{"style":439},[2914],{"type":398,"value":511},{"type":393,"tag":427,"props":2916,"children":2917},{"style":493},[2918],{"type":398,"value":571},{"type":393,"tag":427,"props":2920,"children":2921},{"style":439},[2922],{"type":398,"value":511},{"type":393,"tag":427,"props":2924,"children":2925},{"style":493},[2926],{"type":398,"value":580},{"type":393,"tag":427,"props":2928,"children":2929},{"style":439},[2930],{"type":398,"value":511},{"type":393,"tag":427,"props":2932,"children":2933},{"style":493},[2934],{"type":398,"value":589},{"type":393,"tag":427,"props":2936,"children":2937},{"style":439},[2938],{"type":398,"value":511},{"type":393,"tag":427,"props":2940,"children":2941},{"style":493},[2942],{"type":398,"value":598},{"type":393,"tag":427,"props":2944,"children":2945},{"style":439},[2946],{"type":398,"value":511},{"type":393,"tag":427,"props":2948,"children":2949},{"style":493},[2950],{"type":398,"value":2951},"'Frank'",{"type":393,"tag":427,"props":2953,"children":2954},{"style":439},[2955],{"type":398,"value":545},{"type":393,"tag":427,"props":2957,"children":2958},{"class":429,"line":72},[2959,2964,2968,2973,2977,2982,2986,2991,2995,3000,3004,3009,3013,3018],{"type":393,"tag":427,"props":2960,"children":2961},{"style":493},[2962],{"type":398,"value":2963},"    'rating'",{"type":393,"tag":427,"props":2965,"children":2966},{"style":439},[2967],{"type":398,"value":501},{"type":393,"tag":427,"props":2969,"children":2970},{"style":617},[2971],{"type":398,"value":2972},"4.5",{"type":393,"tag":427,"props":2974,"children":2975},{"style":439},[2976],{"type":398,"value":511},{"type":393,"tag":427,"props":2978,"children":2979},{"style":617},[2980],{"type":398,"value":2981},"4.8",{"type":393,"tag":427,"props":2983,"children":2984},{"style":439},[2985],{"type":398,"value":511},{"type":393,"tag":427,"props":2987,"children":2988},{"style":617},[2989],{"type":398,"value":2990},"4.2",{"type":393,"tag":427,"props":2992,"children":2993},{"style":439},[2994],{"type":398,"value":511},{"type":393,"tag":427,"props":2996,"children":2997},{"style":617},[2998],{"type":398,"value":2999},"4.6",{"type":393,"tag":427,"props":3001,"children":3002},{"style":439},[3003],{"type":398,"value":511},{"type":393,"tag":427,"props":3005,"children":3006},{"style":617},[3007],{"type":398,"value":3008},"4.0",{"type":393,"tag":427,"props":3010,"children":3011},{"style":439},[3012],{"type":398,"value":511},{"type":393,"tag":427,"props":3014,"children":3015},{"style":617},[3016],{"type":398,"value":3017},"4.3",{"type":393,"tag":427,"props":3019,"children":3020},{"style":439},[3021],{"type":398,"value":545},{"type":393,"tag":427,"props":3023,"children":3024},{"class":429,"line":83},[3025,3030,3034,3039,3043,3048,3052,3057,3061,3065,3069,3074,3078,3083],{"type":393,"tag":427,"props":3026,"children":3027},{"style":493},[3028],{"type":398,"value":3029},"    'projects'",{"type":393,"tag":427,"props":3031,"children":3032},{"style":439},[3033],{"type":398,"value":501},{"type":393,"tag":427,"props":3035,"children":3036},{"style":617},[3037],{"type":398,"value":3038},"8",{"type":393,"tag":427,"props":3040,"children":3041},{"style":439},[3042],{"type":398,"value":511},{"type":393,"tag":427,"props":3044,"children":3045},{"style":617},[3046],{"type":398,"value":3047},"12",{"type":393,"tag":427,"props":3049,"children":3050},{"style":439},[3051],{"type":398,"value":511},{"type":393,"tag":427,"props":3053,"children":3054},{"style":617},[3055],{"type":398,"value":3056},"6",{"type":393,"tag":427,"props":3058,"children":3059},{"style":439},[3060],{"type":398,"value":511},{"type":393,"tag":427,"props":3062,"children":3063},{"style":617},[3064],{"type":398,"value":2553},{"type":393,"tag":427,"props":3066,"children":3067},{"style":439},[3068],{"type":398,"value":511},{"type":393,"tag":427,"props":3070,"children":3071},{"style":617},[3072],{"type":398,"value":3073},"4",{"type":393,"tag":427,"props":3075,"children":3076},{"style":439},[3077],{"type":398,"value":511},{"type":393,"tag":427,"props":3079,"children":3080},{"style":617},[3081],{"type":398,"value":3082},"5",{"type":393,"tag":427,"props":3084,"children":3085},{"style":439},[3086],{"type":398,"value":718},{"type":393,"tag":427,"props":3088,"children":3089},{"class":429,"line":92},[3090],{"type":393,"tag":427,"props":3091,"children":3092},{"style":439},[3093],{"type":398,"value":726},{"type":393,"tag":427,"props":3095,"children":3096},{"class":429,"line":101},[3097],{"type":393,"tag":427,"props":3098,"children":3099},{"emptyLinePlaceholder":12},[3100],{"type":398,"value":460},{"type":393,"tag":427,"props":3102,"children":3103},{"class":429,"line":110},[3104,3108,3112,3117],{"type":393,"tag":427,"props":3105,"children":3106},{"style":617},[3107],{"type":398,"value":741},{"type":393,"tag":427,"props":3109,"children":3110},{"style":439},[3111],{"type":398,"value":746},{"type":393,"tag":427,"props":3113,"children":3114},{"style":493},[3115],{"type":398,"value":3116},"\"Performance data:\"",{"type":393,"tag":427,"props":3118,"children":3119},{"style":439},[3120],{"type":398,"value":756},{"type":393,"tag":427,"props":3122,"children":3123},{"class":429,"line":121},[3124,3128],{"type":393,"tag":427,"props":3125,"children":3126},{"style":617},[3127],{"type":398,"value":741},{"type":393,"tag":427,"props":3129,"children":3130},{"style":439},[3131],{"type":398,"value":3132},"(performance)\n",{"type":393,"tag":427,"props":3134,"children":3135},{"class":429,"line":130},[3136,3140],{"type":393,"tag":427,"props":3137,"children":3138},{"style":617},[3139],{"type":398,"value":741},{"type":393,"tag":427,"props":3141,"children":3142},{"style":439},[3143],{"type":398,"value":780},{"type":393,"tag":427,"props":3145,"children":3146},{"class":429,"line":139},[3147],{"type":393,"tag":427,"props":3148,"children":3149},{"emptyLinePlaceholder":12},[3150],{"type":398,"value":460},{"type":393,"tag":427,"props":3152,"children":3153},{"class":429,"line":148},[3154],{"type":393,"tag":427,"props":3155,"children":3156},{"style":466},[3157],{"type":398,"value":3158},"# Named aggregations for clarity\n",{"type":393,"tag":427,"props":3160,"children":3161},{"class":429,"line":159},[3162,3166,3170,3175,3180],{"type":393,"tag":427,"props":3163,"children":3164},{"style":439},[3165],{"type":398,"value":803},{"type":393,"tag":427,"props":3167,"children":3168},{"style":433},[3169],{"type":398,"value":482},{"type":393,"tag":427,"props":3171,"children":3172},{"style":439},[3173],{"type":398,"value":3174}," performance.groupby(",{"type":393,"tag":427,"props":3176,"children":3177},{"style":493},[3178],{"type":398,"value":3179},"'department'",{"type":393,"tag":427,"props":3181,"children":3182},{"style":439},[3183],{"type":398,"value":3184},").agg(\n",{"type":393,"tag":427,"props":3186,"children":3187},{"class":429,"line":168},[3188,3194,3198,3202,3207,3211,3215],{"type":393,"tag":427,"props":3189,"children":3191},{"style":3190},"--shiki-default:#E36209;--shiki-app-dark-mode:#FFAB70",[3192],{"type":398,"value":3193},"    avg_rating",{"type":393,"tag":427,"props":3195,"children":3196},{"style":433},[3197],{"type":398,"value":482},{"type":393,"tag":427,"props":3199,"children":3200},{"style":439},[3201],{"type":398,"value":746},{"type":393,"tag":427,"props":3203,"children":3204},{"style":493},[3205],{"type":398,"value":3206},"'rating'",{"type":393,"tag":427,"props":3208,"children":3209},{"style":439},[3210],{"type":398,"value":511},{"type":393,"tag":427,"props":3212,"children":3213},{"style":493},[3214],{"type":398,"value":847},{"type":393,"tag":427,"props":3216,"children":3217},{"style":439},[3218],{"type":398,"value":3219},"),\n",{"type":393,"tag":427,"props":3221,"children":3222},{"class":429,"line":177},[3223,3228,3232,3236,3240,3244,3248],{"type":393,"tag":427,"props":3224,"children":3225},{"style":3190},[3226],{"type":398,"value":3227},"    max_rating",{"type":393,"tag":427,"props":3229,"children":3230},{"style":433},[3231],{"type":398,"value":482},{"type":393,"tag":427,"props":3233,"children":3234},{"style":439},[3235],{"type":398,"value":746},{"type":393,"tag":427,"props":3237,"children":3238},{"style":493},[3239],{"type":398,"value":3206},{"type":393,"tag":427,"props":3241,"children":3242},{"style":439},[3243],{"type":398,"value":511},{"type":393,"tag":427,"props":3245,"children":3246},{"style":493},[3247],{"type":398,"value":856},{"type":393,"tag":427,"props":3249,"children":3250},{"style":439},[3251],{"type":398,"value":3219},{"type":393,"tag":427,"props":3253,"children":3254},{"class":429,"line":186},[3255,3260,3264,3268,3273,3277,3281],{"type":393,"tag":427,"props":3256,"children":3257},{"style":3190},[3258],{"type":398,"value":3259},"    total_projects",{"type":393,"tag":427,"props":3261,"children":3262},{"style":433},[3263],{"type":398,"value":482},{"type":393,"tag":427,"props":3265,"children":3266},{"style":439},[3267],{"type":398,"value":746},{"type":393,"tag":427,"props":3269,"children":3270},{"style":493},[3271],{"type":398,"value":3272},"'projects'",{"type":393,"tag":427,"props":3274,"children":3275},{"style":439},[3276],{"type":398,"value":511},{"type":393,"tag":427,"props":3278,"children":3279},{"style":493},[3280],{"type":398,"value":838},{"type":393,"tag":427,"props":3282,"children":3283},{"style":439},[3284],{"type":398,"value":3219},{"type":393,"tag":427,"props":3286,"children":3287},{"class":429,"line":197},[3288,3293,3297,3301,3306,3310,3314],{"type":393,"tag":427,"props":3289,"children":3290},{"style":3190},[3291],{"type":398,"value":3292},"    team_size",{"type":393,"tag":427,"props":3294,"children":3295},{"style":433},[3296],{"type":398,"value":482},{"type":393,"tag":427,"props":3298,"children":3299},{"style":439},[3300],{"type":398,"value":746},{"type":393,"tag":427,"props":3302,"children":3303},{"style":493},[3304],{"type":398,"value":3305},"'employee'",{"type":393,"tag":427,"props":3307,"children":3308},{"style":439},[3309],{"type":398,"value":511},{"type":393,"tag":427,"props":3311,"children":3312},{"style":493},[3313],{"type":398,"value":2717},{"type":393,"tag":427,"props":3315,"children":3316},{"style":439},[3317],{"type":398,"value":756},{"type":393,"tag":427,"props":3319,"children":3320},{"class":429,"line":206},[3321,3326,3330],{"type":393,"tag":427,"props":3322,"children":3323},{"style":439},[3324],{"type":398,"value":3325},").round(",{"type":393,"tag":427,"props":3327,"children":3328},{"style":617},[3329],{"type":398,"value":1632},{"type":393,"tag":427,"props":3331,"children":3332},{"style":439},[3333],{"type":398,"value":756},{"type":393,"tag":427,"props":3335,"children":3336},{"class":429,"line":215},[3337],{"type":393,"tag":427,"props":3338,"children":3339},{"emptyLinePlaceholder":12},[3340],{"type":398,"value":460},{"type":393,"tag":427,"props":3342,"children":3343},{"class":429,"line":224},[3344,3348,3352,3357],{"type":393,"tag":427,"props":3345,"children":3346},{"style":617},[3347],{"type":398,"value":741},{"type":393,"tag":427,"props":3349,"children":3350},{"style":439},[3351],{"type":398,"value":746},{"type":393,"tag":427,"props":3353,"children":3354},{"style":493},[3355],{"type":398,"value":3356},"\"Department summary:\"",{"type":393,"tag":427,"props":3358,"children":3359},{"style":439},[3360],{"type":398,"value":756},{"type":393,"tag":427,"props":3362,"children":3363},{"class":429,"line":233},[3364,3368],{"type":393,"tag":427,"props":3365,"children":3366},{"style":617},[3367],{"type":398,"value":741},{"type":393,"tag":427,"props":3369,"children":3370},{"style":439},[3371],{"type":398,"value":926},{"type":393,"tag":928,"props":3373,"children":3375},{"id":3374},"conditional-aggregations",[3376],{"type":398,"value":3377},"🔍 Conditional Aggregations",{"type":393,"tag":401,"props":3379,"children":3380},{},[3381],{"type":398,"value":3382},"You can apply conditions within aggregations:",{"type":393,"tag":412,"props":3384,"children":3385},{},[3386],{"type":393,"tag":416,"props":3387,"children":3389},{"className":418,"code":3388,"language":420,"meta":6,"style":6},"import pandas as pd\n\n# Sales with performance targets\nsales = pd.DataFrame({\n    'region': ['North', 'South', 'North', 'South', 'North', 'South'],\n    'salesperson': ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve', 'Frank'],\n    'sales': [85000, 120000, 78000, 95000, 110000, 88000],\n    'target': [80000, 100000, 75000, 90000, 100000, 85000]\n})\n\nprint(\"Sales vs targets:\")\nprint(sales)\nprint()\n\n# Calculate performance metrics\ndef above_target_count(group):\n    \"\"\"Count how many salespeople exceeded their target\"\"\"\n    return (group['sales'] > group['target']).sum()\n\ndef avg_performance(group):\n    \"\"\"Calculate average performance vs target\"\"\"\n    return (group['sales'] / group['target']).mean()\n\nperformance = sales.groupby('region').apply(lambda x: pd.Series({\n    'total_sales': x['sales'].sum(),\n    'avg_target_achievement': avg_performance(x),\n    'people_above_target': above_target_count(x),\n    'team_size': len(x)\n}))\n\nprint(\"Regional performance:\")\nprint(performance.round(2))\n",[3390],{"type":393,"tag":423,"props":3391,"children":3392},{"__ignoreMap":6},[3393,3412,3419,3427,3442,3501,3560,3621,3685,3692,3699,3719,3730,3741,3748,3756,3773,3781,3821,3828,3844,3852,3889,3896,3930,3952,3965,3978,4001,4009,4016,4036],{"type":393,"tag":427,"props":3394,"children":3395},{"class":429,"line":11},[3396,3400,3404,3408],{"type":393,"tag":427,"props":3397,"children":3398},{"style":433},[3399],{"type":398,"value":436},{"type":393,"tag":427,"props":3401,"children":3402},{"style":439},[3403],{"type":398,"value":442},{"type":393,"tag":427,"props":3405,"children":3406},{"style":433},[3407],{"type":398,"value":447},{"type":393,"tag":427,"props":3409,"children":3410},{"style":439},[3411],{"type":398,"value":452},{"type":393,"tag":427,"props":3413,"children":3414},{"class":429,"line":27},[3415],{"type":393,"tag":427,"props":3416,"children":3417},{"emptyLinePlaceholder":12},[3418],{"type":398,"value":460},{"type":393,"tag":427,"props":3420,"children":3421},{"class":429,"line":36},[3422],{"type":393,"tag":427,"props":3423,"children":3424},{"style":466},[3425],{"type":398,"value":3426},"# Sales with performance targets\n",{"type":393,"tag":427,"props":3428,"children":3429},{"class":429,"line":45},[3430,3434,3438],{"type":393,"tag":427,"props":3431,"children":3432},{"style":439},[3433],{"type":398,"value":2413},{"type":393,"tag":427,"props":3435,"children":3436},{"style":433},[3437],{"type":398,"value":482},{"type":393,"tag":427,"props":3439,"children":3440},{"style":439},[3441],{"type":398,"value":487},{"type":393,"tag":427,"props":3443,"children":3444},{"class":429,"line":54},[3445,3449,3453,3457,3461,3465,3469,3473,3477,3481,3485,3489,3493,3497],{"type":393,"tag":427,"props":3446,"children":3447},{"style":493},[3448],{"type":398,"value":496},{"type":393,"tag":427,"props":3450,"children":3451},{"style":439},[3452],{"type":398,"value":501},{"type":393,"tag":427,"props":3454,"children":3455},{"style":493},[3456],{"type":398,"value":506},{"type":393,"tag":427,"props":3458,"children":3459},{"style":439},[3460],{"type":398,"value":511},{"type":393,"tag":427,"props":3462,"children":3463},{"style":493},[3464],{"type":398,"value":516},{"type":393,"tag":427,"props":3466,"children":3467},{"style":439},[3468],{"type":398,"value":511},{"type":393,"tag":427,"props":3470,"children":3471},{"style":493},[3472],{"type":398,"value":506},{"type":393,"tag":427,"props":3474,"children":3475},{"style":439},[3476],{"type":398,"value":511},{"type":393,"tag":427,"props":3478,"children":3479},{"style":493},[3480],{"type":398,"value":516},{"type":393,"tag":427,"props":3482,"children":3483},{"style":439},[3484],{"type":398,"value":511},{"type":393,"tag":427,"props":3486,"children":3487},{"style":493},[3488],{"type":398,"value":506},{"type":393,"tag":427,"props":3490,"children":3491},{"style":439},[3492],{"type":398,"value":511},{"type":393,"tag":427,"props":3494,"children":3495},{"style":493},[3496],{"type":398,"value":516},{"type":393,"tag":427,"props":3498,"children":3499},{"style":439},[3500],{"type":398,"value":545},{"type":393,"tag":427,"props":3502,"children":3503},{"class":429,"line":63},[3504,3508,3512,3516,3520,3524,3528,3532,3536,3540,3544,3548,3552,3556],{"type":393,"tag":427,"props":3505,"children":3506},{"style":493},[3507],{"type":398,"value":553},{"type":393,"tag":427,"props":3509,"children":3510},{"style":439},[3511],{"type":398,"value":501},{"type":393,"tag":427,"props":3513,"children":3514},{"style":493},[3515],{"type":398,"value":562},{"type":393,"tag":427,"props":3517,"children":3518},{"style":439},[3519],{"type":398,"value":511},{"type":393,"tag":427,"props":3521,"children":3522},{"style":493},[3523],{"type":398,"value":571},{"type":393,"tag":427,"props":3525,"children":3526},{"style":439},[3527],{"type":398,"value":511},{"type":393,"tag":427,"props":3529,"children":3530},{"style":493},[3531],{"type":398,"value":580},{"type":393,"tag":427,"props":3533,"children":3534},{"style":439},[3535],{"type":398,"value":511},{"type":393,"tag":427,"props":3537,"children":3538},{"style":493},[3539],{"type":398,"value":589},{"type":393,"tag":427,"props":3541,"children":3542},{"style":439},[3543],{"type":398,"value":511},{"type":393,"tag":427,"props":3545,"children":3546},{"style":493},[3547],{"type":398,"value":598},{"type":393,"tag":427,"props":3549,"children":3550},{"style":439},[3551],{"type":398,"value":511},{"type":393,"tag":427,"props":3553,"children":3554},{"style":493},[3555],{"type":398,"value":2951},{"type":393,"tag":427,"props":3557,"children":3558},{"style":439},[3559],{"type":398,"value":545},{"type":393,"tag":427,"props":3561,"children":3562},{"class":429,"line":72},[3563,3567,3571,3575,3579,3584,3588,3592,3596,3600,3604,3609,3613,3617],{"type":393,"tag":427,"props":3564,"children":3565},{"style":493},[3566],{"type":398,"value":610},{"type":393,"tag":427,"props":3568,"children":3569},{"style":439},[3570],{"type":398,"value":501},{"type":393,"tag":427,"props":3572,"children":3573},{"style":617},[3574],{"type":398,"value":620},{"type":393,"tag":427,"props":3576,"children":3577},{"style":439},[3578],{"type":398,"value":511},{"type":393,"tag":427,"props":3580,"children":3581},{"style":617},[3582],{"type":398,"value":3583},"120000",{"type":393,"tag":427,"props":3585,"children":3586},{"style":439},[3587],{"type":398,"value":511},{"type":393,"tag":427,"props":3589,"children":3590},{"style":617},[3591],{"type":398,"value":638},{"type":393,"tag":427,"props":3593,"children":3594},{"style":439},[3595],{"type":398,"value":511},{"type":393,"tag":427,"props":3597,"children":3598},{"style":617},[3599],{"type":398,"value":656},{"type":393,"tag":427,"props":3601,"children":3602},{"style":439},[3603],{"type":398,"value":511},{"type":393,"tag":427,"props":3605,"children":3606},{"style":617},[3607],{"type":398,"value":3608},"110000",{"type":393,"tag":427,"props":3610,"children":3611},{"style":439},[3612],{"type":398,"value":511},{"type":393,"tag":427,"props":3614,"children":3615},{"style":617},[3616],{"type":398,"value":647},{"type":393,"tag":427,"props":3618,"children":3619},{"style":439},[3620],{"type":398,"value":545},{"type":393,"tag":427,"props":3622,"children":3623},{"class":429,"line":83},[3624,3629,3633,3638,3642,3647,3651,3656,3660,3665,3669,3673,3677,3681],{"type":393,"tag":427,"props":3625,"children":3626},{"style":493},[3627],{"type":398,"value":3628},"    'target'",{"type":393,"tag":427,"props":3630,"children":3631},{"style":439},[3632],{"type":398,"value":501},{"type":393,"tag":427,"props":3634,"children":3635},{"style":617},[3636],{"type":398,"value":3637},"80000",{"type":393,"tag":427,"props":3639,"children":3640},{"style":439},[3641],{"type":398,"value":511},{"type":393,"tag":427,"props":3643,"children":3644},{"style":617},[3645],{"type":398,"value":3646},"100000",{"type":393,"tag":427,"props":3648,"children":3649},{"style":439},[3650],{"type":398,"value":511},{"type":393,"tag":427,"props":3652,"children":3653},{"style":617},[3654],{"type":398,"value":3655},"75000",{"type":393,"tag":427,"props":3657,"children":3658},{"style":439},[3659],{"type":398,"value":511},{"type":393,"tag":427,"props":3661,"children":3662},{"style":617},[3663],{"type":398,"value":3664},"90000",{"type":393,"tag":427,"props":3666,"children":3667},{"style":439},[3668],{"type":398,"value":511},{"type":393,"tag":427,"props":3670,"children":3671},{"style":617},[3672],{"type":398,"value":3646},{"type":393,"tag":427,"props":3674,"children":3675},{"style":439},[3676],{"type":398,"value":511},{"type":393,"tag":427,"props":3678,"children":3679},{"style":617},[3680],{"type":398,"value":620},{"type":393,"tag":427,"props":3682,"children":3683},{"style":439},[3684],{"type":398,"value":718},{"type":393,"tag":427,"props":3686,"children":3687},{"class":429,"line":92},[3688],{"type":393,"tag":427,"props":3689,"children":3690},{"style":439},[3691],{"type":398,"value":726},{"type":393,"tag":427,"props":3693,"children":3694},{"class":429,"line":101},[3695],{"type":393,"tag":427,"props":3696,"children":3697},{"emptyLinePlaceholder":12},[3698],{"type":398,"value":460},{"type":393,"tag":427,"props":3700,"children":3701},{"class":429,"line":110},[3702,3706,3710,3715],{"type":393,"tag":427,"props":3703,"children":3704},{"style":617},[3705],{"type":398,"value":741},{"type":393,"tag":427,"props":3707,"children":3708},{"style":439},[3709],{"type":398,"value":746},{"type":393,"tag":427,"props":3711,"children":3712},{"style":493},[3713],{"type":398,"value":3714},"\"Sales vs targets:\"",{"type":393,"tag":427,"props":3716,"children":3717},{"style":439},[3718],{"type":398,"value":756},{"type":393,"tag":427,"props":3720,"children":3721},{"class":429,"line":121},[3722,3726],{"type":393,"tag":427,"props":3723,"children":3724},{"style":617},[3725],{"type":398,"value":741},{"type":393,"tag":427,"props":3727,"children":3728},{"style":439},[3729],{"type":398,"value":2628},{"type":393,"tag":427,"props":3731,"children":3732},{"class":429,"line":130},[3733,3737],{"type":393,"tag":427,"props":3734,"children":3735},{"style":617},[3736],{"type":398,"value":741},{"type":393,"tag":427,"props":3738,"children":3739},{"style":439},[3740],{"type":398,"value":780},{"type":393,"tag":427,"props":3742,"children":3743},{"class":429,"line":139},[3744],{"type":393,"tag":427,"props":3745,"children":3746},{"emptyLinePlaceholder":12},[3747],{"type":398,"value":460},{"type":393,"tag":427,"props":3749,"children":3750},{"class":429,"line":148},[3751],{"type":393,"tag":427,"props":3752,"children":3753},{"style":466},[3754],{"type":398,"value":3755},"# Calculate performance metrics\n",{"type":393,"tag":427,"props":3757,"children":3758},{"class":429,"line":159},[3759,3763,3768],{"type":393,"tag":427,"props":3760,"children":3761},{"style":433},[3762],{"type":398,"value":2259},{"type":393,"tag":427,"props":3764,"children":3765},{"style":2262},[3766],{"type":398,"value":3767}," above_target_count",{"type":393,"tag":427,"props":3769,"children":3770},{"style":439},[3771],{"type":398,"value":3772},"(group):\n",{"type":393,"tag":427,"props":3774,"children":3775},{"class":429,"line":168},[3776],{"type":393,"tag":427,"props":3777,"children":3778},{"style":493},[3779],{"type":398,"value":3780},"    \"\"\"Count how many salespeople exceeded their target\"\"\"\n",{"type":393,"tag":427,"props":3782,"children":3783},{"class":429,"line":177},[3784,3788,3793,3798,3802,3806,3811,3816],{"type":393,"tag":427,"props":3785,"children":3786},{"style":433},[3787],{"type":398,"value":2286},{"type":393,"tag":427,"props":3789,"children":3790},{"style":439},[3791],{"type":398,"value":3792}," (group[",{"type":393,"tag":427,"props":3794,"children":3795},{"style":493},[3796],{"type":398,"value":3797},"'sales'",{"type":393,"tag":427,"props":3799,"children":3800},{"style":439},[3801],{"type":398,"value":2355},{"type":393,"tag":427,"props":3803,"children":3804},{"style":433},[3805],{"type":398,"value":2375},{"type":393,"tag":427,"props":3807,"children":3808},{"style":439},[3809],{"type":398,"value":3810}," group[",{"type":393,"tag":427,"props":3812,"children":3813},{"style":493},[3814],{"type":398,"value":3815},"'target'",{"type":393,"tag":427,"props":3817,"children":3818},{"style":439},[3819],{"type":398,"value":3820},"]).sum()\n",{"type":393,"tag":427,"props":3822,"children":3823},{"class":429,"line":186},[3824],{"type":393,"tag":427,"props":3825,"children":3826},{"emptyLinePlaceholder":12},[3827],{"type":398,"value":460},{"type":393,"tag":427,"props":3829,"children":3830},{"class":429,"line":197},[3831,3835,3840],{"type":393,"tag":427,"props":3832,"children":3833},{"style":433},[3834],{"type":398,"value":2259},{"type":393,"tag":427,"props":3836,"children":3837},{"style":2262},[3838],{"type":398,"value":3839}," avg_performance",{"type":393,"tag":427,"props":3841,"children":3842},{"style":439},[3843],{"type":398,"value":3772},{"type":393,"tag":427,"props":3845,"children":3846},{"class":429,"line":206},[3847],{"type":393,"tag":427,"props":3848,"children":3849},{"style":493},[3850],{"type":398,"value":3851},"    \"\"\"Calculate average performance vs target\"\"\"\n",{"type":393,"tag":427,"props":3853,"children":3854},{"class":429,"line":215},[3855,3859,3863,3867,3871,3876,3880,3884],{"type":393,"tag":427,"props":3856,"children":3857},{"style":433},[3858],{"type":398,"value":2286},{"type":393,"tag":427,"props":3860,"children":3861},{"style":439},[3862],{"type":398,"value":3792},{"type":393,"tag":427,"props":3864,"children":3865},{"style":493},[3866],{"type":398,"value":3797},{"type":393,"tag":427,"props":3868,"children":3869},{"style":439},[3870],{"type":398,"value":2355},{"type":393,"tag":427,"props":3872,"children":3873},{"style":433},[3874],{"type":398,"value":3875},"/",{"type":393,"tag":427,"props":3877,"children":3878},{"style":439},[3879],{"type":398,"value":3810},{"type":393,"tag":427,"props":3881,"children":3882},{"style":493},[3883],{"type":398,"value":3815},{"type":393,"tag":427,"props":3885,"children":3886},{"style":439},[3887],{"type":398,"value":3888},"]).mean()\n",{"type":393,"tag":427,"props":3890,"children":3891},{"class":429,"line":224},[3892],{"type":393,"tag":427,"props":3893,"children":3894},{"emptyLinePlaceholder":12},[3895],{"type":398,"value":460},{"type":393,"tag":427,"props":3897,"children":3898},{"class":429,"line":233},[3899,3903,3907,3911,3915,3920,3925],{"type":393,"tag":427,"props":3900,"children":3901},{"style":439},[3902],{"type":398,"value":2823},{"type":393,"tag":427,"props":3904,"children":3905},{"style":433},[3906],{"type":398,"value":482},{"type":393,"tag":427,"props":3908,"children":3909},{"style":439},[3910],{"type":398,"value":2671},{"type":393,"tag":427,"props":3912,"children":3913},{"style":493},[3914],{"type":398,"value":817},{"type":393,"tag":427,"props":3916,"children":3917},{"style":439},[3918],{"type":398,"value":3919},").apply(",{"type":393,"tag":427,"props":3921,"children":3922},{"style":433},[3923],{"type":398,"value":3924},"lambda",{"type":393,"tag":427,"props":3926,"children":3927},{"style":439},[3928],{"type":398,"value":3929}," x: pd.Series({\n",{"type":393,"tag":427,"props":3931,"children":3932},{"class":429,"line":244},[3933,3938,3943,3947],{"type":393,"tag":427,"props":3934,"children":3935},{"style":493},[3936],{"type":398,"value":3937},"    'total_sales'",{"type":393,"tag":427,"props":3939,"children":3940},{"style":439},[3941],{"type":398,"value":3942},": x[",{"type":393,"tag":427,"props":3944,"children":3945},{"style":493},[3946],{"type":398,"value":3797},{"type":393,"tag":427,"props":3948,"children":3949},{"style":439},[3950],{"type":398,"value":3951},"].sum(),\n",{"type":393,"tag":427,"props":3953,"children":3954},{"class":429,"line":253},[3955,3960],{"type":393,"tag":427,"props":3956,"children":3957},{"style":493},[3958],{"type":398,"value":3959},"    'avg_target_achievement'",{"type":393,"tag":427,"props":3961,"children":3962},{"style":439},[3963],{"type":398,"value":3964},": avg_performance(x),\n",{"type":393,"tag":427,"props":3966,"children":3967},{"class":429,"line":262},[3968,3973],{"type":393,"tag":427,"props":3969,"children":3970},{"style":493},[3971],{"type":398,"value":3972},"    'people_above_target'",{"type":393,"tag":427,"props":3974,"children":3975},{"style":439},[3976],{"type":398,"value":3977},": above_target_count(x),\n",{"type":393,"tag":427,"props":3979,"children":3980},{"class":429,"line":271},[3981,3986,3991,3996],{"type":393,"tag":427,"props":3982,"children":3983},{"style":493},[3984],{"type":398,"value":3985},"    'team_size'",{"type":393,"tag":427,"props":3987,"children":3988},{"style":439},[3989],{"type":398,"value":3990},": ",{"type":393,"tag":427,"props":3992,"children":3993},{"style":617},[3994],{"type":398,"value":3995},"len",{"type":393,"tag":427,"props":3997,"children":3998},{"style":439},[3999],{"type":398,"value":4000},"(x)\n",{"type":393,"tag":427,"props":4002,"children":4003},{"class":429,"line":281},[4004],{"type":393,"tag":427,"props":4005,"children":4006},{"style":439},[4007],{"type":398,"value":4008},"}))\n",{"type":393,"tag":427,"props":4010,"children":4011},{"class":429,"line":290},[4012],{"type":393,"tag":427,"props":4013,"children":4014},{"emptyLinePlaceholder":12},[4015],{"type":398,"value":460},{"type":393,"tag":427,"props":4017,"children":4018},{"class":429,"line":299},[4019,4023,4027,4032],{"type":393,"tag":427,"props":4020,"children":4021},{"style":617},[4022],{"type":398,"value":741},{"type":393,"tag":427,"props":4024,"children":4025},{"style":439},[4026],{"type":398,"value":746},{"type":393,"tag":427,"props":4028,"children":4029},{"style":493},[4030],{"type":398,"value":4031},"\"Regional performance:\"",{"type":393,"tag":427,"props":4033,"children":4034},{"style":439},[4035],{"type":398,"value":756},{"type":393,"tag":427,"props":4037,"children":4038},{"class":429,"line":308},[4039,4043,4048,4052],{"type":393,"tag":427,"props":4040,"children":4041},{"style":617},[4042],{"type":398,"value":741},{"type":393,"tag":427,"props":4044,"children":4045},{"style":439},[4046],{"type":398,"value":4047},"(performance.round(",{"type":393,"tag":427,"props":4049,"children":4050},{"style":617},[4051],{"type":398,"value":1632},{"type":393,"tag":427,"props":4053,"children":4054},{"style":439},[4055],{"type":398,"value":1637},{"type":393,"tag":928,"props":4057,"children":4059},{"id":4058},"percentile-and-quantile-analysis",[4060],{"type":398,"value":4061},"📊 Percentile and Quantile Analysis",{"type":393,"tag":401,"props":4063,"children":4064},{},[4065],{"type":398,"value":4066},"Percentiles help you understand data distribution:",{"type":393,"tag":940,"props":4068,"children":4070},{"emoji":942,"title":4069,"type":944},"Understanding Percentiles",[4071,4079,4102,4110,4128,4136],{"type":393,"tag":401,"props":4072,"children":4073},{},[4074],{"type":393,"tag":950,"props":4075,"children":4076},{},[4077],{"type":398,"value":4078},"What are Percentiles?",{"type":393,"tag":956,"props":4080,"children":4081},{},[4082,4087,4092,4097],{"type":393,"tag":960,"props":4083,"children":4084},{},[4085],{"type":398,"value":4086},"50th percentile = median (middle value)",{"type":393,"tag":960,"props":4088,"children":4089},{},[4090],{"type":398,"value":4091},"25th percentile = first quartile (Q1)",{"type":393,"tag":960,"props":4093,"children":4094},{},[4095],{"type":398,"value":4096},"75th percentile = third quartile (Q3)",{"type":393,"tag":960,"props":4098,"children":4099},{},[4100],{"type":398,"value":4101},"90th percentile = 90% of data is below this value",{"type":393,"tag":401,"props":4103,"children":4104},{},[4105],{"type":393,"tag":950,"props":4106,"children":4107},{},[4108],{"type":398,"value":4109},"Business Applications:",{"type":393,"tag":956,"props":4111,"children":4112},{},[4113,4118,4123],{"type":393,"tag":960,"props":4114,"children":4115},{},[4116],{"type":398,"value":4117},"Income analysis: \"What's the 90th percentile salary?\"",{"type":393,"tag":960,"props":4119,"children":4120},{},[4121],{"type":398,"value":4122},"Performance metrics: \"Top 10% performers\"",{"type":393,"tag":960,"props":4124,"children":4125},{},[4126],{"type":398,"value":4127},"Quality control: \"95th percentile response time\"",{"type":393,"tag":401,"props":4129,"children":4130},{},[4131],{"type":393,"tag":950,"props":4132,"children":4133},{},[4134],{"type":398,"value":4135},"Use Cases:",{"type":393,"tag":956,"props":4137,"children":4138},{},[4139,4144,4149],{"type":393,"tag":960,"props":4140,"children":4141},{},[4142],{"type":398,"value":4143},"Understanding data spread",{"type":393,"tag":960,"props":4145,"children":4146},{},[4147],{"type":398,"value":4148},"Identifying outliers",{"type":393,"tag":960,"props":4150,"children":4151},{},[4152],{"type":398,"value":4153},"Setting benchmarks and targets",{"type":393,"tag":412,"props":4155,"children":4156},{},[4157],{"type":393,"tag":416,"props":4158,"children":4160},{"className":418,"code":4159,"language":420,"meta":6,"style":6},"import pandas as pd\n\n# Customer spending data\nspending = pd.DataFrame({\n    'segment': ['Premium', 'Standard', 'Premium', 'Standard', 'Premium', 'Standard'],\n    'monthly_spend': [250, 45, 380, 62, 420, 38],\n    'orders': [8, 3, 12, 4, 15, 2]\n})\n\nprint(\"Customer spending:\")\nprint(spending)\nprint()\n\n# Percentile analysis\npercentiles = spending.groupby('segment')['monthly_spend'].agg([\n    ('25th_percentile', lambda x: x.quantile(0.25)),\n    ('median', 'median'),\n    ('75th_percentile', lambda x: x.quantile(0.75)),\n    ('max', 'max')\n])\n\nprint(\"Spending percentiles by segment:\")\nprint(percentiles)\n",[4161],{"type":393,"tag":423,"props":4162,"children":4163},{"__ignoreMap":6},[4164,4183,4190,4198,4214,4276,4342,4403,4410,4417,4437,4449,4460,4467,4475,4510,4546,4570,4603,4626,4633,4640,4660],{"type":393,"tag":427,"props":4165,"children":4166},{"class":429,"line":11},[4167,4171,4175,4179],{"type":393,"tag":427,"props":4168,"children":4169},{"style":433},[4170],{"type":398,"value":436},{"type":393,"tag":427,"props":4172,"children":4173},{"style":439},[4174],{"type":398,"value":442},{"type":393,"tag":427,"props":4176,"children":4177},{"style":433},[4178],{"type":398,"value":447},{"type":393,"tag":427,"props":4180,"children":4181},{"style":439},[4182],{"type":398,"value":452},{"type":393,"tag":427,"props":4184,"children":4185},{"class":429,"line":27},[4186],{"type":393,"tag":427,"props":4187,"children":4188},{"emptyLinePlaceholder":12},[4189],{"type":398,"value":460},{"type":393,"tag":427,"props":4191,"children":4192},{"class":429,"line":36},[4193],{"type":393,"tag":427,"props":4194,"children":4195},{"style":466},[4196],{"type":398,"value":4197},"# Customer spending data\n",{"type":393,"tag":427,"props":4199,"children":4200},{"class":429,"line":45},[4201,4206,4210],{"type":393,"tag":427,"props":4202,"children":4203},{"style":439},[4204],{"type":398,"value":4205},"spending ",{"type":393,"tag":427,"props":4207,"children":4208},{"style":433},[4209],{"type":398,"value":482},{"type":393,"tag":427,"props":4211,"children":4212},{"style":439},[4213],{"type":398,"value":487},{"type":393,"tag":427,"props":4215,"children":4216},{"class":429,"line":54},[4217,4222,4226,4231,4235,4240,4244,4248,4252,4256,4260,4264,4268,4272],{"type":393,"tag":427,"props":4218,"children":4219},{"style":493},[4220],{"type":398,"value":4221},"    'segment'",{"type":393,"tag":427,"props":4223,"children":4224},{"style":439},[4225],{"type":398,"value":501},{"type":393,"tag":427,"props":4227,"children":4228},{"style":493},[4229],{"type":398,"value":4230},"'Premium'",{"type":393,"tag":427,"props":4232,"children":4233},{"style":439},[4234],{"type":398,"value":511},{"type":393,"tag":427,"props":4236,"children":4237},{"style":493},[4238],{"type":398,"value":4239},"'Standard'",{"type":393,"tag":427,"props":4241,"children":4242},{"style":439},[4243],{"type":398,"value":511},{"type":393,"tag":427,"props":4245,"children":4246},{"style":493},[4247],{"type":398,"value":4230},{"type":393,"tag":427,"props":4249,"children":4250},{"style":439},[4251],{"type":398,"value":511},{"type":393,"tag":427,"props":4253,"children":4254},{"style":493},[4255],{"type":398,"value":4239},{"type":393,"tag":427,"props":4257,"children":4258},{"style":439},[4259],{"type":398,"value":511},{"type":393,"tag":427,"props":4261,"children":4262},{"style":493},[4263],{"type":398,"value":4230},{"type":393,"tag":427,"props":4265,"children":4266},{"style":439},[4267],{"type":398,"value":511},{"type":393,"tag":427,"props":4269,"children":4270},{"style":493},[4271],{"type":398,"value":4239},{"type":393,"tag":427,"props":4273,"children":4274},{"style":439},[4275],{"type":398,"value":545},{"type":393,"tag":427,"props":4277,"children":4278},{"class":429,"line":63},[4279,4284,4288,4293,4297,4302,4306,4311,4315,4320,4324,4329,4333,4338],{"type":393,"tag":427,"props":4280,"children":4281},{"style":493},[4282],{"type":398,"value":4283},"    'monthly_spend'",{"type":393,"tag":427,"props":4285,"children":4286},{"style":439},[4287],{"type":398,"value":501},{"type":393,"tag":427,"props":4289,"children":4290},{"style":617},[4291],{"type":398,"value":4292},"250",{"type":393,"tag":427,"props":4294,"children":4295},{"style":439},[4296],{"type":398,"value":511},{"type":393,"tag":427,"props":4298,"children":4299},{"style":617},[4300],{"type":398,"value":4301},"45",{"type":393,"tag":427,"props":4303,"children":4304},{"style":439},[4305],{"type":398,"value":511},{"type":393,"tag":427,"props":4307,"children":4308},{"style":617},[4309],{"type":398,"value":4310},"380",{"type":393,"tag":427,"props":4312,"children":4313},{"style":439},[4314],{"type":398,"value":511},{"type":393,"tag":427,"props":4316,"children":4317},{"style":617},[4318],{"type":398,"value":4319},"62",{"type":393,"tag":427,"props":4321,"children":4322},{"style":439},[4323],{"type":398,"value":511},{"type":393,"tag":427,"props":4325,"children":4326},{"style":617},[4327],{"type":398,"value":4328},"420",{"type":393,"tag":427,"props":4330,"children":4331},{"style":439},[4332],{"type":398,"value":511},{"type":393,"tag":427,"props":4334,"children":4335},{"style":617},[4336],{"type":398,"value":4337},"38",{"type":393,"tag":427,"props":4339,"children":4340},{"style":439},[4341],{"type":398,"value":545},{"type":393,"tag":427,"props":4343,"children":4344},{"class":429,"line":72},[4345,4350,4354,4358,4362,4367,4371,4375,4379,4383,4387,4391,4395,4399],{"type":393,"tag":427,"props":4346,"children":4347},{"style":493},[4348],{"type":398,"value":4349},"    'orders'",{"type":393,"tag":427,"props":4351,"children":4352},{"style":439},[4353],{"type":398,"value":501},{"type":393,"tag":427,"props":4355,"children":4356},{"style":617},[4357],{"type":398,"value":3038},{"type":393,"tag":427,"props":4359,"children":4360},{"style":439},[4361],{"type":398,"value":511},{"type":393,"tag":427,"props":4363,"children":4364},{"style":617},[4365],{"type":398,"value":4366},"3",{"type":393,"tag":427,"props":4368,"children":4369},{"style":439},[4370],{"type":398,"value":511},{"type":393,"tag":427,"props":4372,"children":4373},{"style":617},[4374],{"type":398,"value":3047},{"type":393,"tag":427,"props":4376,"children":4377},{"style":439},[4378],{"type":398,"value":511},{"type":393,"tag":427,"props":4380,"children":4381},{"style":617},[4382],{"type":398,"value":3073},{"type":393,"tag":427,"props":4384,"children":4385},{"style":439},[4386],{"type":398,"value":511},{"type":393,"tag":427,"props":4388,"children":4389},{"style":617},[4390],{"type":398,"value":2553},{"type":393,"tag":427,"props":4392,"children":4393},{"style":439},[4394],{"type":398,"value":511},{"type":393,"tag":427,"props":4396,"children":4397},{"style":617},[4398],{"type":398,"value":1632},{"type":393,"tag":427,"props":4400,"children":4401},{"style":439},[4402],{"type":398,"value":718},{"type":393,"tag":427,"props":4404,"children":4405},{"class":429,"line":83},[4406],{"type":393,"tag":427,"props":4407,"children":4408},{"style":439},[4409],{"type":398,"value":726},{"type":393,"tag":427,"props":4411,"children":4412},{"class":429,"line":92},[4413],{"type":393,"tag":427,"props":4414,"children":4415},{"emptyLinePlaceholder":12},[4416],{"type":398,"value":460},{"type":393,"tag":427,"props":4418,"children":4419},{"class":429,"line":101},[4420,4424,4428,4433],{"type":393,"tag":427,"props":4421,"children":4422},{"style":617},[4423],{"type":398,"value":741},{"type":393,"tag":427,"props":4425,"children":4426},{"style":439},[4427],{"type":398,"value":746},{"type":393,"tag":427,"props":4429,"children":4430},{"style":493},[4431],{"type":398,"value":4432},"\"Customer spending:\"",{"type":393,"tag":427,"props":4434,"children":4435},{"style":439},[4436],{"type":398,"value":756},{"type":393,"tag":427,"props":4438,"children":4439},{"class":429,"line":110},[4440,4444],{"type":393,"tag":427,"props":4441,"children":4442},{"style":617},[4443],{"type":398,"value":741},{"type":393,"tag":427,"props":4445,"children":4446},{"style":439},[4447],{"type":398,"value":4448},"(spending)\n",{"type":393,"tag":427,"props":4450,"children":4451},{"class":429,"line":121},[4452,4456],{"type":393,"tag":427,"props":4453,"children":4454},{"style":617},[4455],{"type":398,"value":741},{"type":393,"tag":427,"props":4457,"children":4458},{"style":439},[4459],{"type":398,"value":780},{"type":393,"tag":427,"props":4461,"children":4462},{"class":429,"line":130},[4463],{"type":393,"tag":427,"props":4464,"children":4465},{"emptyLinePlaceholder":12},[4466],{"type":398,"value":460},{"type":393,"tag":427,"props":4468,"children":4469},{"class":429,"line":139},[4470],{"type":393,"tag":427,"props":4471,"children":4472},{"style":466},[4473],{"type":398,"value":4474},"# Percentile analysis\n",{"type":393,"tag":427,"props":4476,"children":4477},{"class":429,"line":148},[4478,4483,4487,4492,4497,4501,4506],{"type":393,"tag":427,"props":4479,"children":4480},{"style":439},[4481],{"type":398,"value":4482},"percentiles ",{"type":393,"tag":427,"props":4484,"children":4485},{"style":433},[4486],{"type":398,"value":482},{"type":393,"tag":427,"props":4488,"children":4489},{"style":439},[4490],{"type":398,"value":4491}," spending.groupby(",{"type":393,"tag":427,"props":4493,"children":4494},{"style":493},[4495],{"type":398,"value":4496},"'segment'",{"type":393,"tag":427,"props":4498,"children":4499},{"style":439},[4500],{"type":398,"value":1493},{"type":393,"tag":427,"props":4502,"children":4503},{"style":493},[4504],{"type":398,"value":4505},"'monthly_spend'",{"type":393,"tag":427,"props":4507,"children":4508},{"style":439},[4509],{"type":398,"value":1503},{"type":393,"tag":427,"props":4511,"children":4512},{"class":429,"line":159},[4513,4518,4523,4527,4531,4536,4541],{"type":393,"tag":427,"props":4514,"children":4515},{"style":439},[4516],{"type":398,"value":4517},"    (",{"type":393,"tag":427,"props":4519,"children":4520},{"style":493},[4521],{"type":398,"value":4522},"'25th_percentile'",{"type":393,"tag":427,"props":4524,"children":4525},{"style":439},[4526],{"type":398,"value":511},{"type":393,"tag":427,"props":4528,"children":4529},{"style":433},[4530],{"type":398,"value":3924},{"type":393,"tag":427,"props":4532,"children":4533},{"style":439},[4534],{"type":398,"value":4535}," x: x.quantile(",{"type":393,"tag":427,"props":4537,"children":4538},{"style":617},[4539],{"type":398,"value":4540},"0.25",{"type":393,"tag":427,"props":4542,"children":4543},{"style":439},[4544],{"type":398,"value":4545},")),\n",{"type":393,"tag":427,"props":4547,"children":4548},{"class":429,"line":168},[4549,4553,4558,4562,4566],{"type":393,"tag":427,"props":4550,"children":4551},{"style":439},[4552],{"type":398,"value":4517},{"type":393,"tag":427,"props":4554,"children":4555},{"style":493},[4556],{"type":398,"value":4557},"'median'",{"type":393,"tag":427,"props":4559,"children":4560},{"style":439},[4561],{"type":398,"value":511},{"type":393,"tag":427,"props":4563,"children":4564},{"style":493},[4565],{"type":398,"value":4557},{"type":393,"tag":427,"props":4567,"children":4568},{"style":439},[4569],{"type":398,"value":3219},{"type":393,"tag":427,"props":4571,"children":4572},{"class":429,"line":177},[4573,4577,4582,4586,4590,4594,4599],{"type":393,"tag":427,"props":4574,"children":4575},{"style":439},[4576],{"type":398,"value":4517},{"type":393,"tag":427,"props":4578,"children":4579},{"style":493},[4580],{"type":398,"value":4581},"'75th_percentile'",{"type":393,"tag":427,"props":4583,"children":4584},{"style":439},[4585],{"type":398,"value":511},{"type":393,"tag":427,"props":4587,"children":4588},{"style":433},[4589],{"type":398,"value":3924},{"type":393,"tag":427,"props":4591,"children":4592},{"style":439},[4593],{"type":398,"value":4535},{"type":393,"tag":427,"props":4595,"children":4596},{"style":617},[4597],{"type":398,"value":4598},"0.75",{"type":393,"tag":427,"props":4600,"children":4601},{"style":439},[4602],{"type":398,"value":4545},{"type":393,"tag":427,"props":4604,"children":4605},{"class":429,"line":186},[4606,4610,4614,4618,4622],{"type":393,"tag":427,"props":4607,"children":4608},{"style":439},[4609],{"type":398,"value":4517},{"type":393,"tag":427,"props":4611,"children":4612},{"style":493},[4613],{"type":398,"value":856},{"type":393,"tag":427,"props":4615,"children":4616},{"style":439},[4617],{"type":398,"value":511},{"type":393,"tag":427,"props":4619,"children":4620},{"style":493},[4621],{"type":398,"value":856},{"type":393,"tag":427,"props":4623,"children":4624},{"style":439},[4625],{"type":398,"value":756},{"type":393,"tag":427,"props":4627,"children":4628},{"class":429,"line":197},[4629],{"type":393,"tag":427,"props":4630,"children":4631},{"style":439},[4632],{"type":398,"value":1595},{"type":393,"tag":427,"props":4634,"children":4635},{"class":429,"line":206},[4636],{"type":393,"tag":427,"props":4637,"children":4638},{"emptyLinePlaceholder":12},[4639],{"type":398,"value":460},{"type":393,"tag":427,"props":4641,"children":4642},{"class":429,"line":215},[4643,4647,4651,4656],{"type":393,"tag":427,"props":4644,"children":4645},{"style":617},[4646],{"type":398,"value":741},{"type":393,"tag":427,"props":4648,"children":4649},{"style":439},[4650],{"type":398,"value":746},{"type":393,"tag":427,"props":4652,"children":4653},{"style":493},[4654],{"type":398,"value":4655},"\"Spending percentiles by segment:\"",{"type":393,"tag":427,"props":4657,"children":4658},{"style":439},[4659],{"type":398,"value":756},{"type":393,"tag":427,"props":4661,"children":4662},{"class":429,"line":224},[4663,4667],{"type":393,"tag":427,"props":4664,"children":4665},{"style":617},[4666],{"type":398,"value":741},{"type":393,"tag":427,"props":4668,"children":4669},{"style":439},[4670],{"type":398,"value":4671},"(percentiles)\n",{"type":393,"tag":928,"props":4673,"children":4675},{"id":4674},"advanced-aggregation-techniques",[4676],{"type":398,"value":4677},"🔧 Advanced Aggregation Techniques",{"type":393,"tag":4679,"props":4680,"children":4682},"h3",{"id":4681},"transform-vs-aggregation",[4683],{"type":398,"value":4684},"Transform vs Aggregation",{"type":393,"tag":940,"props":4686,"children":4690},{"emoji":4687,"title":4688,"type":4689},"⚙️","Transform vs Aggregate","warning",[4691,4699,4725,4733,4751,4759],{"type":393,"tag":401,"props":4692,"children":4693},{},[4694],{"type":393,"tag":950,"props":4695,"children":4696},{},[4697],{"type":398,"value":4698},"Aggregation:",{"type":393,"tag":956,"props":4700,"children":4701},{},[4702,4707,4712],{"type":393,"tag":960,"props":4703,"children":4704},{},[4705],{"type":398,"value":4706},"Reduces groups to single values",{"type":393,"tag":960,"props":4708,"children":4709},{},[4710],{"type":398,"value":4711},"Result has fewer rows than original",{"type":393,"tag":960,"props":4713,"children":4714},{},[4715,4717,4723],{"type":398,"value":4716},"Example: ",{"type":393,"tag":423,"props":4718,"children":4720},{"className":4719},[],[4721],{"type":398,"value":4722},"groupby().sum()",{"type":398,"value":4724}," → one sum per group",{"type":393,"tag":401,"props":4726,"children":4727},{},[4728],{"type":393,"tag":950,"props":4729,"children":4730},{},[4731],{"type":398,"value":4732},"Transform:",{"type":393,"tag":956,"props":4734,"children":4735},{},[4736,4741,4746],{"type":393,"tag":960,"props":4737,"children":4738},{},[4739],{"type":398,"value":4740},"Keeps original DataFrame size",{"type":393,"tag":960,"props":4742,"children":4743},{},[4744],{"type":398,"value":4745},"Broadcasts group statistics back to all rows",{"type":393,"tag":960,"props":4747,"children":4748},{},[4749],{"type":398,"value":4750},"Example: Add group average to each row",{"type":393,"tag":401,"props":4752,"children":4753},{},[4754],{"type":393,"tag":950,"props":4755,"children":4756},{},[4757],{"type":398,"value":4758},"When to Use:",{"type":393,"tag":956,"props":4760,"children":4761},{},[4762,4767],{"type":393,"tag":960,"props":4763,"children":4764},{},[4765],{"type":398,"value":4766},"Aggregation: Summary reports, dashboards",{"type":393,"tag":960,"props":4768,"children":4769},{},[4770],{"type":398,"value":4771},"Transform: Adding group statistics to individual records",{"type":393,"tag":412,"props":4773,"children":4774},{},[4775],{"type":393,"tag":416,"props":4776,"children":4778},{"className":418,"code":4777,"language":420,"meta":6,"style":6},"import pandas as pd\n\n# Sales team data\nteam = pd.DataFrame({\n    'region': ['North', 'North', 'South', 'South'],\n    'salesperson': ['Alice', 'Bob', 'Charlie', 'Diana'],\n    'sales': [85000, 78000, 92000, 88000]\n})\n\nprint(\"Original data:\")\nprint(team)\nprint()\n\n# Aggregation: Summarize by region\nregion_summary = team.groupby('region')['sales'].agg(['sum', 'mean'])\nprint(\"Aggregation (summary):\")\nprint(region_summary)\nprint()\n\n# Transform: Add regional average to each row\nteam['region_avg'] = team.groupby('region')['sales'].transform('mean')\nprint(\"Transform (added column):\")\nprint(team)\n",[4779],{"type":393,"tag":423,"props":4780,"children":4781},{"__ignoreMap":6},[4782,4801,4808,4816,4831,4874,4917,4960,4967,4974,4994,5005,5016,5023,5031,5080,5100,5112,5123,5130,5138,5188,5208],{"type":393,"tag":427,"props":4783,"children":4784},{"class":429,"line":11},[4785,4789,4793,4797],{"type":393,"tag":427,"props":4786,"children":4787},{"style":433},[4788],{"type":398,"value":436},{"type":393,"tag":427,"props":4790,"children":4791},{"style":439},[4792],{"type":398,"value":442},{"type":393,"tag":427,"props":4794,"children":4795},{"style":433},[4796],{"type":398,"value":447},{"type":393,"tag":427,"props":4798,"children":4799},{"style":439},[4800],{"type":398,"value":452},{"type":393,"tag":427,"props":4802,"children":4803},{"class":429,"line":27},[4804],{"type":393,"tag":427,"props":4805,"children":4806},{"emptyLinePlaceholder":12},[4807],{"type":398,"value":460},{"type":393,"tag":427,"props":4809,"children":4810},{"class":429,"line":36},[4811],{"type":393,"tag":427,"props":4812,"children":4813},{"style":466},[4814],{"type":398,"value":4815},"# Sales team data\n",{"type":393,"tag":427,"props":4817,"children":4818},{"class":429,"line":45},[4819,4823,4827],{"type":393,"tag":427,"props":4820,"children":4821},{"style":439},[4822],{"type":398,"value":477},{"type":393,"tag":427,"props":4824,"children":4825},{"style":433},[4826],{"type":398,"value":482},{"type":393,"tag":427,"props":4828,"children":4829},{"style":439},[4830],{"type":398,"value":487},{"type":393,"tag":427,"props":4832,"children":4833},{"class":429,"line":54},[4834,4838,4842,4846,4850,4854,4858,4862,4866,4870],{"type":393,"tag":427,"props":4835,"children":4836},{"style":493},[4837],{"type":398,"value":496},{"type":393,"tag":427,"props":4839,"children":4840},{"style":439},[4841],{"type":398,"value":501},{"type":393,"tag":427,"props":4843,"children":4844},{"style":493},[4845],{"type":398,"value":506},{"type":393,"tag":427,"props":4847,"children":4848},{"style":439},[4849],{"type":398,"value":511},{"type":393,"tag":427,"props":4851,"children":4852},{"style":493},[4853],{"type":398,"value":506},{"type":393,"tag":427,"props":4855,"children":4856},{"style":439},[4857],{"type":398,"value":511},{"type":393,"tag":427,"props":4859,"children":4860},{"style":493},[4861],{"type":398,"value":516},{"type":393,"tag":427,"props":4863,"children":4864},{"style":439},[4865],{"type":398,"value":511},{"type":393,"tag":427,"props":4867,"children":4868},{"style":493},[4869],{"type":398,"value":516},{"type":393,"tag":427,"props":4871,"children":4872},{"style":439},[4873],{"type":398,"value":545},{"type":393,"tag":427,"props":4875,"children":4876},{"class":429,"line":63},[4877,4881,4885,4889,4893,4897,4901,4905,4909,4913],{"type":393,"tag":427,"props":4878,"children":4879},{"style":493},[4880],{"type":398,"value":553},{"type":393,"tag":427,"props":4882,"children":4883},{"style":439},[4884],{"type":398,"value":501},{"type":393,"tag":427,"props":4886,"children":4887},{"style":493},[4888],{"type":398,"value":562},{"type":393,"tag":427,"props":4890,"children":4891},{"style":439},[4892],{"type":398,"value":511},{"type":393,"tag":427,"props":4894,"children":4895},{"style":493},[4896],{"type":398,"value":571},{"type":393,"tag":427,"props":4898,"children":4899},{"style":439},[4900],{"type":398,"value":511},{"type":393,"tag":427,"props":4902,"children":4903},{"style":493},[4904],{"type":398,"value":580},{"type":393,"tag":427,"props":4906,"children":4907},{"style":439},[4908],{"type":398,"value":511},{"type":393,"tag":427,"props":4910,"children":4911},{"style":493},[4912],{"type":398,"value":589},{"type":393,"tag":427,"props":4914,"children":4915},{"style":439},[4916],{"type":398,"value":545},{"type":393,"tag":427,"props":4918,"children":4919},{"class":429,"line":72},[4920,4924,4928,4932,4936,4940,4944,4948,4952,4956],{"type":393,"tag":427,"props":4921,"children":4922},{"style":493},[4923],{"type":398,"value":610},{"type":393,"tag":427,"props":4925,"children":4926},{"style":439},[4927],{"type":398,"value":501},{"type":393,"tag":427,"props":4929,"children":4930},{"style":617},[4931],{"type":398,"value":620},{"type":393,"tag":427,"props":4933,"children":4934},{"style":439},[4935],{"type":398,"value":511},{"type":393,"tag":427,"props":4937,"children":4938},{"style":617},[4939],{"type":398,"value":638},{"type":393,"tag":427,"props":4941,"children":4942},{"style":439},[4943],{"type":398,"value":511},{"type":393,"tag":427,"props":4945,"children":4946},{"style":617},[4947],{"type":398,"value":629},{"type":393,"tag":427,"props":4949,"children":4950},{"style":439},[4951],{"type":398,"value":511},{"type":393,"tag":427,"props":4953,"children":4954},{"style":617},[4955],{"type":398,"value":647},{"type":393,"tag":427,"props":4957,"children":4958},{"style":439},[4959],{"type":398,"value":718},{"type":393,"tag":427,"props":4961,"children":4962},{"class":429,"line":83},[4963],{"type":393,"tag":427,"props":4964,"children":4965},{"style":439},[4966],{"type":398,"value":726},{"type":393,"tag":427,"props":4968,"children":4969},{"class":429,"line":92},[4970],{"type":393,"tag":427,"props":4971,"children":4972},{"emptyLinePlaceholder":12},[4973],{"type":398,"value":460},{"type":393,"tag":427,"props":4975,"children":4976},{"class":429,"line":101},[4977,4981,4985,4990],{"type":393,"tag":427,"props":4978,"children":4979},{"style":617},[4980],{"type":398,"value":741},{"type":393,"tag":427,"props":4982,"children":4983},{"style":439},[4984],{"type":398,"value":746},{"type":393,"tag":427,"props":4986,"children":4987},{"style":493},[4988],{"type":398,"value":4989},"\"Original data:\"",{"type":393,"tag":427,"props":4991,"children":4992},{"style":439},[4993],{"type":398,"value":756},{"type":393,"tag":427,"props":4995,"children":4996},{"class":429,"line":110},[4997,5001],{"type":393,"tag":427,"props":4998,"children":4999},{"style":617},[5000],{"type":398,"value":741},{"type":393,"tag":427,"props":5002,"children":5003},{"style":439},[5004],{"type":398,"value":768},{"type":393,"tag":427,"props":5006,"children":5007},{"class":429,"line":121},[5008,5012],{"type":393,"tag":427,"props":5009,"children":5010},{"style":617},[5011],{"type":398,"value":741},{"type":393,"tag":427,"props":5013,"children":5014},{"style":439},[5015],{"type":398,"value":780},{"type":393,"tag":427,"props":5017,"children":5018},{"class":429,"line":130},[5019],{"type":393,"tag":427,"props":5020,"children":5021},{"emptyLinePlaceholder":12},[5022],{"type":398,"value":460},{"type":393,"tag":427,"props":5024,"children":5025},{"class":429,"line":139},[5026],{"type":393,"tag":427,"props":5027,"children":5028},{"style":466},[5029],{"type":398,"value":5030},"# Aggregation: Summarize by region\n",{"type":393,"tag":427,"props":5032,"children":5033},{"class":429,"line":148},[5034,5039,5043,5047,5051,5055,5059,5064,5068,5072,5076],{"type":393,"tag":427,"props":5035,"children":5036},{"style":439},[5037],{"type":398,"value":5038},"region_summary ",{"type":393,"tag":427,"props":5040,"children":5041},{"style":433},[5042],{"type":398,"value":482},{"type":393,"tag":427,"props":5044,"children":5045},{"style":439},[5046],{"type":398,"value":812},{"type":393,"tag":427,"props":5048,"children":5049},{"style":493},[5050],{"type":398,"value":817},{"type":393,"tag":427,"props":5052,"children":5053},{"style":439},[5054],{"type":398,"value":1493},{"type":393,"tag":427,"props":5056,"children":5057},{"style":493},[5058],{"type":398,"value":3797},{"type":393,"tag":427,"props":5060,"children":5061},{"style":439},[5062],{"type":398,"value":5063},"].agg([",{"type":393,"tag":427,"props":5065,"children":5066},{"style":493},[5067],{"type":398,"value":838},{"type":393,"tag":427,"props":5069,"children":5070},{"style":439},[5071],{"type":398,"value":511},{"type":393,"tag":427,"props":5073,"children":5074},{"style":493},[5075],{"type":398,"value":847},{"type":393,"tag":427,"props":5077,"children":5078},{"style":439},[5079],{"type":398,"value":1595},{"type":393,"tag":427,"props":5081,"children":5082},{"class":429,"line":159},[5083,5087,5091,5096],{"type":393,"tag":427,"props":5084,"children":5085},{"style":617},[5086],{"type":398,"value":741},{"type":393,"tag":427,"props":5088,"children":5089},{"style":439},[5090],{"type":398,"value":746},{"type":393,"tag":427,"props":5092,"children":5093},{"style":493},[5094],{"type":398,"value":5095},"\"Aggregation (summary):\"",{"type":393,"tag":427,"props":5097,"children":5098},{"style":439},[5099],{"type":398,"value":756},{"type":393,"tag":427,"props":5101,"children":5102},{"class":429,"line":168},[5103,5107],{"type":393,"tag":427,"props":5104,"children":5105},{"style":617},[5106],{"type":398,"value":741},{"type":393,"tag":427,"props":5108,"children":5109},{"style":439},[5110],{"type":398,"value":5111},"(region_summary)\n",{"type":393,"tag":427,"props":5113,"children":5114},{"class":429,"line":177},[5115,5119],{"type":393,"tag":427,"props":5116,"children":5117},{"style":617},[5118],{"type":398,"value":741},{"type":393,"tag":427,"props":5120,"children":5121},{"style":439},[5122],{"type":398,"value":780},{"type":393,"tag":427,"props":5124,"children":5125},{"class":429,"line":186},[5126],{"type":393,"tag":427,"props":5127,"children":5128},{"emptyLinePlaceholder":12},[5129],{"type":398,"value":460},{"type":393,"tag":427,"props":5131,"children":5132},{"class":429,"line":197},[5133],{"type":393,"tag":427,"props":5134,"children":5135},{"style":466},[5136],{"type":398,"value":5137},"# Transform: Add regional average to each row\n",{"type":393,"tag":427,"props":5139,"children":5140},{"class":429,"line":206},[5141,5146,5151,5155,5159,5163,5167,5171,5175,5180,5184],{"type":393,"tag":427,"props":5142,"children":5143},{"style":439},[5144],{"type":398,"value":5145},"team[",{"type":393,"tag":427,"props":5147,"children":5148},{"style":493},[5149],{"type":398,"value":5150},"'region_avg'",{"type":393,"tag":427,"props":5152,"children":5153},{"style":439},[5154],{"type":398,"value":2355},{"type":393,"tag":427,"props":5156,"children":5157},{"style":433},[5158],{"type":398,"value":482},{"type":393,"tag":427,"props":5160,"children":5161},{"style":439},[5162],{"type":398,"value":812},{"type":393,"tag":427,"props":5164,"children":5165},{"style":493},[5166],{"type":398,"value":817},{"type":393,"tag":427,"props":5168,"children":5169},{"style":439},[5170],{"type":398,"value":1493},{"type":393,"tag":427,"props":5172,"children":5173},{"style":493},[5174],{"type":398,"value":3797},{"type":393,"tag":427,"props":5176,"children":5177},{"style":439},[5178],{"type":398,"value":5179},"].transform(",{"type":393,"tag":427,"props":5181,"children":5182},{"style":493},[5183],{"type":398,"value":847},{"type":393,"tag":427,"props":5185,"children":5186},{"style":439},[5187],{"type":398,"value":756},{"type":393,"tag":427,"props":5189,"children":5190},{"class":429,"line":215},[5191,5195,5199,5204],{"type":393,"tag":427,"props":5192,"children":5193},{"style":617},[5194],{"type":398,"value":741},{"type":393,"tag":427,"props":5196,"children":5197},{"style":439},[5198],{"type":398,"value":746},{"type":393,"tag":427,"props":5200,"children":5201},{"style":493},[5202],{"type":398,"value":5203},"\"Transform (added column):\"",{"type":393,"tag":427,"props":5205,"children":5206},{"style":439},[5207],{"type":398,"value":756},{"type":393,"tag":427,"props":5209,"children":5210},{"class":429,"line":224},[5211,5215],{"type":393,"tag":427,"props":5212,"children":5213},{"style":617},[5214],{"type":398,"value":741},{"type":393,"tag":427,"props":5216,"children":5217},{"style":439},[5218],{"type":398,"value":768},{"type":393,"tag":928,"props":5220,"children":5222},{"id":5221},"key-takeaways",[5223],{"type":398,"value":5224},"🎯 Key Takeaways",{"type":393,"tag":940,"props":5226,"children":5229},{"emoji":5227,"title":5228,"type":1653},"📚","Aggregation Functions Summary",[5230,5238,5313,5321,5344,5352,5375,5383,5401],{"type":393,"tag":401,"props":5231,"children":5232},{},[5233],{"type":393,"tag":950,"props":5234,"children":5235},{},[5236],{"type":398,"value":5237},"Essential Functions:",{"type":393,"tag":956,"props":5239,"children":5240},{},[5241,5269,5291],{"type":393,"tag":960,"props":5242,"children":5243},{},[5244,5246,5251,5252,5257,5258,5263,5264],{"type":398,"value":5245},"Statistical: ",{"type":393,"tag":423,"props":5247,"children":5249},{"className":5248},[],[5250],{"type":398,"value":968},{"type":398,"value":511},{"type":393,"tag":423,"props":5253,"children":5255},{"className":5254},[],[5256],{"type":398,"value":979},{"type":398,"value":511},{"type":393,"tag":423,"props":5259,"children":5261},{"className":5260},[],[5262],{"type":398,"value":990},{"type":398,"value":511},{"type":393,"tag":423,"props":5265,"children":5267},{"className":5266},[],[5268],{"type":398,"value":1001},{"type":393,"tag":960,"props":5270,"children":5271},{},[5272,5274,5279,5280,5285,5286],{"type":398,"value":5273},"Range: ",{"type":393,"tag":423,"props":5275,"children":5277},{"className":5276},[],[5278],{"type":398,"value":1034},{"type":398,"value":511},{"type":393,"tag":423,"props":5281,"children":5283},{"className":5282},[],[5284],{"type":398,"value":1045},{"type":398,"value":511},{"type":393,"tag":423,"props":5287,"children":5289},{"className":5288},[],[5290],{"type":398,"value":1056},{"type":393,"tag":960,"props":5292,"children":5293},{},[5294,5296,5301,5302,5307,5308],{"type":398,"value":5295},"Counting: ",{"type":393,"tag":423,"props":5297,"children":5299},{"className":5298},[],[5300],{"type":398,"value":1078},{"type":398,"value":511},{"type":393,"tag":423,"props":5303,"children":5305},{"className":5304},[],[5306],{"type":398,"value":1089},{"type":398,"value":511},{"type":393,"tag":423,"props":5309,"children":5311},{"className":5310},[],[5312],{"type":398,"value":1100},{"type":393,"tag":401,"props":5314,"children":5315},{},[5316],{"type":393,"tag":950,"props":5317,"children":5318},{},[5319],{"type":398,"value":5320},"Advanced Techniques:",{"type":393,"tag":956,"props":5322,"children":5323},{},[5324,5329,5334,5339],{"type":393,"tag":960,"props":5325,"children":5326},{},[5327],{"type":398,"value":5328},"Custom functions with business logic",{"type":393,"tag":960,"props":5330,"children":5331},{},[5332],{"type":398,"value":5333},"Named aggregations for clarity",{"type":393,"tag":960,"props":5335,"children":5336},{},[5337],{"type":398,"value":5338},"Conditional aggregations",{"type":393,"tag":960,"props":5340,"children":5341},{},[5342],{"type":398,"value":5343},"Percentile analysis",{"type":393,"tag":401,"props":5345,"children":5346},{},[5347],{"type":393,"tag":950,"props":5348,"children":5349},{},[5350],{"type":398,"value":5351},"Best Practices:",{"type":393,"tag":956,"props":5353,"children":5354},{},[5355,5360,5365,5370],{"type":393,"tag":960,"props":5356,"children":5357},{},[5358],{"type":398,"value":5359},"Choose appropriate functions for your data type",{"type":393,"tag":960,"props":5361,"children":5362},{},[5363],{"type":398,"value":5364},"Use custom functions for specific business rules",{"type":393,"tag":960,"props":5366,"children":5367},{},[5368],{"type":398,"value":5369},"Name aggregations clearly",{"type":393,"tag":960,"props":5371,"children":5372},{},[5373],{"type":398,"value":5374},"Consider both aggregation and transform",{"type":393,"tag":401,"props":5376,"children":5377},{},[5378],{"type":393,"tag":950,"props":5379,"children":5380},{},[5381],{"type":398,"value":5382},"Performance Tips:",{"type":393,"tag":956,"props":5384,"children":5385},{},[5386,5391,5396],{"type":393,"tag":960,"props":5387,"children":5388},{},[5389],{"type":398,"value":5390},"Built-in functions are faster than custom ones",{"type":393,"tag":960,"props":5392,"children":5393},{},[5394],{"type":398,"value":5395},"Use vectorized operations when possible",{"type":393,"tag":960,"props":5397,"children":5398},{},[5399],{"type":398,"value":5400},"Test custom functions on small samples first",{"type":393,"tag":401,"props":5402,"children":5403},{},[5404,5409],{"type":393,"tag":950,"props":5405,"children":5406},{},[5407],{"type":398,"value":5408},"Remember:",{"type":398,"value":5410}," Aggregation functions turn data groups into actionable insights!",{"type":393,"tag":928,"props":5412,"children":5414},{"id":5413},"whats-next",[5415],{"type":398,"value":5416},"🚀 What's Next?",{"type":393,"tag":401,"props":5418,"children":5419},{},[5420],{"type":398,"value":5421},"Perfect! You now have a comprehensive toolkit of aggregation functions. Next, let's learn about pivot tables and cross-tabulation - powerful ways to create summary tables and analyze relationships.",{"type":393,"tag":401,"props":5423,"children":5424},{},[5425,5430,5431],{"type":393,"tag":950,"props":5426,"children":5427},{},[5428],{"type":398,"value":5429},"Continue to",{"type":398,"value":3990},{"type":393,"tag":5432,"props":5433,"children":5434},"a",{"href":295},[5435],{"type":398,"value":296},{"type":393,"tag":401,"props":5437,"children":5438},{},[5439],{"type":398,"value":5440},"Keep aggregating! 📈🔢",{"type":393,"tag":5442,"props":5443,"children":5444},"style",{},[5445],{"type":398,"value":5446},"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":5448},[5449,5450,5451,5452,5453,5454,5455,5456,5459,5460],{"id":930,"depth":27,"text":933},{"id":1138,"depth":27,"text":1141},{"id":1640,"depth":27,"text":1643},{"id":2207,"depth":27,"text":2210},{"id":2763,"depth":27,"text":2766},{"id":3374,"depth":27,"text":3377},{"id":4058,"depth":27,"text":4061},{"id":4674,"depth":27,"text":4677,"children":5457},[5458],{"id":4681,"depth":36,"text":4684},{"id":5221,"depth":27,"text":5224},{"id":5413,"depth":27,"text":5416},1782373726196]