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