[{"data":1,"prerenderedAt":10002},["ShallowReactive",2],{"tutorials-pandas":3,"category-items-pandas":387,"content-/pandas/data-type-conversion":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},"/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",[210],{"_path":211,"_dir":23,"_draft":7,"_partial":7,"_locale":6,"title":212,"description":213,"slug":214,"parentId":182,"order":215,"body":389,"_type":14,"_id":216,"_source":16,"_file":217,"_stem":218,"_extension":19},{"type":390,"children":391,"toc":9989},"root",[392,400,406,574,581,586,1313,1319,1324,2111,2117,2122,3013,3019,3024,4001,4007,4012,4967,4973,4978,6113,6119,6124,7419,7425,7430,7614,8216,8222,8509,8515,8520,9953,9959,9964,9978,9983],{"type":393,"tag":394,"props":395,"children":396},"element","h1",{"id":214},[397],{"type":398,"value":399},"text","🔄 Data Type Conversion",{"type":393,"tag":401,"props":402,"children":403},"p",{},[404],{"type":398,"value":405},"Data type conversion is like making sure you're using the right tools for the job - you can't do math with text, and you can't format numbers as dates! Getting data types right is essential for accurate analysis and prevents errors in calculations.",{"type":393,"tag":407,"props":408,"children":412},"info-box",{"emoji":409,"title":410,"type":411},"🔄","Why Data Types Matter","info",[413,422,430,491,499,554,564],{"type":393,"tag":401,"props":414,"children":415},{},[416],{"type":393,"tag":417,"props":418,"children":419},"strong",{},[420],{"type":398,"value":421},"Data Types = How Computer Understands Your Data",{"type":393,"tag":401,"props":423,"children":424},{},[425],{"type":393,"tag":417,"props":426,"children":427},{},[428],{"type":398,"value":429},"Common Type Issues:",{"type":393,"tag":431,"props":432,"children":433},"ul",{},[434,455,468,486],{"type":393,"tag":435,"props":436,"children":437},"li",{},[438,440,447,449],{"type":398,"value":439},"Numbers stored as text: ",{"type":393,"tag":441,"props":442,"children":444},"code",{"className":443},[],[445],{"type":398,"value":446},"\"123\"",{"type":398,"value":448}," instead of ",{"type":393,"tag":441,"props":450,"children":452},{"className":451},[],[453],{"type":398,"value":454},"123",{"type":393,"tag":435,"props":456,"children":457},{},[458,460,466],{"type":398,"value":459},"Dates stored as text: ",{"type":393,"tag":441,"props":461,"children":463},{"className":462},[],[464],{"type":398,"value":465},"\"2023-01-15\"",{"type":398,"value":467}," instead of datetime",{"type":393,"tag":435,"props":469,"children":470},{},[471,473,479,480],{"type":398,"value":472},"True/False stored as text: ",{"type":393,"tag":441,"props":474,"children":476},{"className":475},[],[477],{"type":398,"value":478},"\"Yes\"",{"type":398,"value":448},{"type":393,"tag":441,"props":481,"children":483},{"className":482},[],[484],{"type":398,"value":485},"True",{"type":393,"tag":435,"props":487,"children":488},{},[489],{"type":398,"value":490},"Categories stored as text: Inefficient memory usage",{"type":393,"tag":401,"props":492,"children":493},{},[494],{"type":393,"tag":417,"props":495,"children":496},{},[497],{"type":398,"value":498},"Problems This Causes:",{"type":393,"tag":431,"props":500,"children":501},{},[502,523,544,549],{"type":393,"tag":435,"props":503,"children":504},{},[505,507,513,515,521],{"type":398,"value":506},"Can't do math: ",{"type":393,"tag":441,"props":508,"children":510},{"className":509},[],[511],{"type":398,"value":512},"\"100\" + \"50\"",{"type":398,"value":514}," = ",{"type":393,"tag":441,"props":516,"children":518},{"className":517},[],[519],{"type":398,"value":520},"\"10050\"",{"type":398,"value":522}," (not 150!)",{"type":393,"tag":435,"props":524,"children":525},{},[526,528,534,536,542],{"type":398,"value":527},"Can't sort properly: ",{"type":393,"tag":441,"props":529,"children":531},{"className":530},[],[532],{"type":398,"value":533},"\"10\"",{"type":398,"value":535}," comes before ",{"type":393,"tag":441,"props":537,"children":539},{"className":538},[],[540],{"type":398,"value":541},"\"2\"",{"type":398,"value":543}," alphabetically",{"type":393,"tag":435,"props":545,"children":546},{},[547],{"type":398,"value":548},"Can't filter dates: Can't find \"last month's data\"",{"type":393,"tag":435,"props":550,"children":551},{},[552],{"type":398,"value":553},"Inefficient analysis: Slower processing, more memory",{"type":393,"tag":401,"props":555,"children":556},{},[557,562],{"type":393,"tag":417,"props":558,"children":559},{},[560],{"type":398,"value":561},"Think of it like:",{"type":398,"value":563}," Using a hammer for everything vs using the right tool for each job!",{"type":393,"tag":401,"props":565,"children":566},{},[567,572],{"type":393,"tag":417,"props":568,"children":569},{},[570],{"type":398,"value":571},"Goal:",{"type":398,"value":573}," Each column should have the data type that matches its content and intended use.",{"type":393,"tag":575,"props":576,"children":578},"h2",{"id":577},"checking-current-data-types",[579],{"type":398,"value":580},"🔍 Checking Current Data Types",{"type":393,"tag":401,"props":582,"children":583},{},[584],{"type":398,"value":585},"First, understand what types you're working with:",{"type":393,"tag":587,"props":588,"children":589},"code-try",{},[590],{"type":393,"tag":591,"props":592,"children":596},"pre",{"className":593,"code":594,"language":595,"meta":6,"style":6},"language-python shiki shiki-themes github-light github-dark","import pandas as pd\n\n# Mixed-up data types (common real-world scenario)\nmessy_data = pd.DataFrame({\n    'customer_id': ['1', '2', '3', '4', '5'],  # Should be numbers\n    'name': ['Alice', 'Bob', 'Charlie', 'Diana', 'Eve'],  # Correct (text)\n    'age': ['25', '30', '35', '28', '32'],  # Should be numbers\n    'signup_date': ['2023-01-15', '2023-02-10', '2023-01-25', '2023-03-05', '2023-02-20'],  # Should be dates\n    'is_premium': ['True', 'False', 'True', 'False', 'True'],  # Should be boolean\n    'total_spent': ['150.50', '89.25', '200.00', '45.75', '175.80']  # Should be numbers\n})\n\nprint(\"📊 Data with Mixed-Up Types:\")\nprint(messy_data)\nprint()\n\nprint(\"🔍 Current Data Types:\")\nprint(messy_data.dtypes)\nprint()\n\nprint(\"Problems:\")\nprint(\"- customer_id is text, should be number\")\nprint(\"- age is text, should be number\") \nprint(\"- signup_date is text, should be date\")\nprint(\"- is_premium is text, should be True/False\")\nprint(\"- total_spent is text, should be decimal number\")\nprint()\n\nprint(\"Let's fix these types!\")\n","python",[597],{"type":393,"tag":441,"props":598,"children":599},{"__ignoreMap":6},[600,627,635,644,662,728,790,851,913,972,1034,1042,1049,1073,1085,1097,1104,1124,1136,1147,1154,1174,1194,1215,1235,1255,1275,1286,1293],{"type":393,"tag":601,"props":602,"children":604},"span",{"class":603,"line":11},"line",[605,611,617,622],{"type":393,"tag":601,"props":606,"children":608},{"style":607},"--shiki-default:#D73A49;--shiki-app-dark-mode:#F97583",[609],{"type":398,"value":610},"import",{"type":393,"tag":601,"props":612,"children":614},{"style":613},"--shiki-default:#24292E;--shiki-app-dark-mode:#E1E4E8",[615],{"type":398,"value":616}," pandas ",{"type":393,"tag":601,"props":618,"children":619},{"style":607},[620],{"type":398,"value":621},"as",{"type":393,"tag":601,"props":623,"children":624},{"style":613},[625],{"type":398,"value":626}," pd\n",{"type":393,"tag":601,"props":628,"children":629},{"class":603,"line":27},[630],{"type":393,"tag":601,"props":631,"children":632},{"emptyLinePlaceholder":12},[633],{"type":398,"value":634},"\n",{"type":393,"tag":601,"props":636,"children":637},{"class":603,"line":36},[638],{"type":393,"tag":601,"props":639,"children":641},{"style":640},"--shiki-default:#6A737D;--shiki-app-dark-mode:#6A737D",[642],{"type":398,"value":643},"# Mixed-up data types (common real-world scenario)\n",{"type":393,"tag":601,"props":645,"children":646},{"class":603,"line":45},[647,652,657],{"type":393,"tag":601,"props":648,"children":649},{"style":613},[650],{"type":398,"value":651},"messy_data ",{"type":393,"tag":601,"props":653,"children":654},{"style":607},[655],{"type":398,"value":656},"=",{"type":393,"tag":601,"props":658,"children":659},{"style":613},[660],{"type":398,"value":661}," pd.DataFrame({\n",{"type":393,"tag":601,"props":663,"children":664},{"class":603,"line":54},[665,671,676,681,686,691,695,700,704,709,713,718,723],{"type":393,"tag":601,"props":666,"children":668},{"style":667},"--shiki-default:#032F62;--shiki-app-dark-mode:#9ECBFF",[669],{"type":398,"value":670},"    'customer_id'",{"type":393,"tag":601,"props":672,"children":673},{"style":613},[674],{"type":398,"value":675},": [",{"type":393,"tag":601,"props":677,"children":678},{"style":667},[679],{"type":398,"value":680},"'1'",{"type":393,"tag":601,"props":682,"children":683},{"style":613},[684],{"type":398,"value":685},", ",{"type":393,"tag":601,"props":687,"children":688},{"style":667},[689],{"type":398,"value":690},"'2'",{"type":393,"tag":601,"props":692,"children":693},{"style":613},[694],{"type":398,"value":685},{"type":393,"tag":601,"props":696,"children":697},{"style":667},[698],{"type":398,"value":699},"'3'",{"type":393,"tag":601,"props":701,"children":702},{"style":613},[703],{"type":398,"value":685},{"type":393,"tag":601,"props":705,"children":706},{"style":667},[707],{"type":398,"value":708},"'4'",{"type":393,"tag":601,"props":710,"children":711},{"style":613},[712],{"type":398,"value":685},{"type":393,"tag":601,"props":714,"children":715},{"style":667},[716],{"type":398,"value":717},"'5'",{"type":393,"tag":601,"props":719,"children":720},{"style":613},[721],{"type":398,"value":722},"],  ",{"type":393,"tag":601,"props":724,"children":725},{"style":640},[726],{"type":398,"value":727},"# Should be numbers\n",{"type":393,"tag":601,"props":729,"children":730},{"class":603,"line":63},[731,736,740,745,749,754,758,763,767,772,776,781,785],{"type":393,"tag":601,"props":732,"children":733},{"style":667},[734],{"type":398,"value":735},"    'name'",{"type":393,"tag":601,"props":737,"children":738},{"style":613},[739],{"type":398,"value":675},{"type":393,"tag":601,"props":741,"children":742},{"style":667},[743],{"type":398,"value":744},"'Alice'",{"type":393,"tag":601,"props":746,"children":747},{"style":613},[748],{"type":398,"value":685},{"type":393,"tag":601,"props":750,"children":751},{"style":667},[752],{"type":398,"value":753},"'Bob'",{"type":393,"tag":601,"props":755,"children":756},{"style":613},[757],{"type":398,"value":685},{"type":393,"tag":601,"props":759,"children":760},{"style":667},[761],{"type":398,"value":762},"'Charlie'",{"type":393,"tag":601,"props":764,"children":765},{"style":613},[766],{"type":398,"value":685},{"type":393,"tag":601,"props":768,"children":769},{"style":667},[770],{"type":398,"value":771},"'Diana'",{"type":393,"tag":601,"props":773,"children":774},{"style":613},[775],{"type":398,"value":685},{"type":393,"tag":601,"props":777,"children":778},{"style":667},[779],{"type":398,"value":780},"'Eve'",{"type":393,"tag":601,"props":782,"children":783},{"style":613},[784],{"type":398,"value":722},{"type":393,"tag":601,"props":786,"children":787},{"style":640},[788],{"type":398,"value":789},"# Correct (text)\n",{"type":393,"tag":601,"props":791,"children":792},{"class":603,"line":72},[793,798,802,807,811,816,820,825,829,834,838,843,847],{"type":393,"tag":601,"props":794,"children":795},{"style":667},[796],{"type":398,"value":797},"    'age'",{"type":393,"tag":601,"props":799,"children":800},{"style":613},[801],{"type":398,"value":675},{"type":393,"tag":601,"props":803,"children":804},{"style":667},[805],{"type":398,"value":806},"'25'",{"type":393,"tag":601,"props":808,"children":809},{"style":613},[810],{"type":398,"value":685},{"type":393,"tag":601,"props":812,"children":813},{"style":667},[814],{"type":398,"value":815},"'30'",{"type":393,"tag":601,"props":817,"children":818},{"style":613},[819],{"type":398,"value":685},{"type":393,"tag":601,"props":821,"children":822},{"style":667},[823],{"type":398,"value":824},"'35'",{"type":393,"tag":601,"props":826,"children":827},{"style":613},[828],{"type":398,"value":685},{"type":393,"tag":601,"props":830,"children":831},{"style":667},[832],{"type":398,"value":833},"'28'",{"type":393,"tag":601,"props":835,"children":836},{"style":613},[837],{"type":398,"value":685},{"type":393,"tag":601,"props":839,"children":840},{"style":667},[841],{"type":398,"value":842},"'32'",{"type":393,"tag":601,"props":844,"children":845},{"style":613},[846],{"type":398,"value":722},{"type":393,"tag":601,"props":848,"children":849},{"style":640},[850],{"type":398,"value":727},{"type":393,"tag":601,"props":852,"children":853},{"class":603,"line":83},[854,859,863,868,872,877,881,886,890,895,899,904,908],{"type":393,"tag":601,"props":855,"children":856},{"style":667},[857],{"type":398,"value":858},"    'signup_date'",{"type":393,"tag":601,"props":860,"children":861},{"style":613},[862],{"type":398,"value":675},{"type":393,"tag":601,"props":864,"children":865},{"style":667},[866],{"type":398,"value":867},"'2023-01-15'",{"type":393,"tag":601,"props":869,"children":870},{"style":613},[871],{"type":398,"value":685},{"type":393,"tag":601,"props":873,"children":874},{"style":667},[875],{"type":398,"value":876},"'2023-02-10'",{"type":393,"tag":601,"props":878,"children":879},{"style":613},[880],{"type":398,"value":685},{"type":393,"tag":601,"props":882,"children":883},{"style":667},[884],{"type":398,"value":885},"'2023-01-25'",{"type":393,"tag":601,"props":887,"children":888},{"style":613},[889],{"type":398,"value":685},{"type":393,"tag":601,"props":891,"children":892},{"style":667},[893],{"type":398,"value":894},"'2023-03-05'",{"type":393,"tag":601,"props":896,"children":897},{"style":613},[898],{"type":398,"value":685},{"type":393,"tag":601,"props":900,"children":901},{"style":667},[902],{"type":398,"value":903},"'2023-02-20'",{"type":393,"tag":601,"props":905,"children":906},{"style":613},[907],{"type":398,"value":722},{"type":393,"tag":601,"props":909,"children":910},{"style":640},[911],{"type":398,"value":912},"# Should be dates\n",{"type":393,"tag":601,"props":914,"children":915},{"class":603,"line":92},[916,921,925,930,934,939,943,947,951,955,959,963,967],{"type":393,"tag":601,"props":917,"children":918},{"style":667},[919],{"type":398,"value":920},"    'is_premium'",{"type":393,"tag":601,"props":922,"children":923},{"style":613},[924],{"type":398,"value":675},{"type":393,"tag":601,"props":926,"children":927},{"style":667},[928],{"type":398,"value":929},"'True'",{"type":393,"tag":601,"props":931,"children":932},{"style":613},[933],{"type":398,"value":685},{"type":393,"tag":601,"props":935,"children":936},{"style":667},[937],{"type":398,"value":938},"'False'",{"type":393,"tag":601,"props":940,"children":941},{"style":613},[942],{"type":398,"value":685},{"type":393,"tag":601,"props":944,"children":945},{"style":667},[946],{"type":398,"value":929},{"type":393,"tag":601,"props":948,"children":949},{"style":613},[950],{"type":398,"value":685},{"type":393,"tag":601,"props":952,"children":953},{"style":667},[954],{"type":398,"value":938},{"type":393,"tag":601,"props":956,"children":957},{"style":613},[958],{"type":398,"value":685},{"type":393,"tag":601,"props":960,"children":961},{"style":667},[962],{"type":398,"value":929},{"type":393,"tag":601,"props":964,"children":965},{"style":613},[966],{"type":398,"value":722},{"type":393,"tag":601,"props":968,"children":969},{"style":640},[970],{"type":398,"value":971},"# Should be boolean\n",{"type":393,"tag":601,"props":973,"children":974},{"class":603,"line":101},[975,980,984,989,993,998,1002,1007,1011,1016,1020,1025,1030],{"type":393,"tag":601,"props":976,"children":977},{"style":667},[978],{"type":398,"value":979},"    'total_spent'",{"type":393,"tag":601,"props":981,"children":982},{"style":613},[983],{"type":398,"value":675},{"type":393,"tag":601,"props":985,"children":986},{"style":667},[987],{"type":398,"value":988},"'150.50'",{"type":393,"tag":601,"props":990,"children":991},{"style":613},[992],{"type":398,"value":685},{"type":393,"tag":601,"props":994,"children":995},{"style":667},[996],{"type":398,"value":997},"'89.25'",{"type":393,"tag":601,"props":999,"children":1000},{"style":613},[1001],{"type":398,"value":685},{"type":393,"tag":601,"props":1003,"children":1004},{"style":667},[1005],{"type":398,"value":1006},"'200.00'",{"type":393,"tag":601,"props":1008,"children":1009},{"style":613},[1010],{"type":398,"value":685},{"type":393,"tag":601,"props":1012,"children":1013},{"style":667},[1014],{"type":398,"value":1015},"'45.75'",{"type":393,"tag":601,"props":1017,"children":1018},{"style":613},[1019],{"type":398,"value":685},{"type":393,"tag":601,"props":1021,"children":1022},{"style":667},[1023],{"type":398,"value":1024},"'175.80'",{"type":393,"tag":601,"props":1026,"children":1027},{"style":613},[1028],{"type":398,"value":1029},"]  ",{"type":393,"tag":601,"props":1031,"children":1032},{"style":640},[1033],{"type":398,"value":727},{"type":393,"tag":601,"props":1035,"children":1036},{"class":603,"line":110},[1037],{"type":393,"tag":601,"props":1038,"children":1039},{"style":613},[1040],{"type":398,"value":1041},"})\n",{"type":393,"tag":601,"props":1043,"children":1044},{"class":603,"line":121},[1045],{"type":393,"tag":601,"props":1046,"children":1047},{"emptyLinePlaceholder":12},[1048],{"type":398,"value":634},{"type":393,"tag":601,"props":1050,"children":1051},{"class":603,"line":130},[1052,1058,1063,1068],{"type":393,"tag":601,"props":1053,"children":1055},{"style":1054},"--shiki-default:#005CC5;--shiki-app-dark-mode:#79B8FF",[1056],{"type":398,"value":1057},"print",{"type":393,"tag":601,"props":1059,"children":1060},{"style":613},[1061],{"type":398,"value":1062},"(",{"type":393,"tag":601,"props":1064,"children":1065},{"style":667},[1066],{"type":398,"value":1067},"\"📊 Data with Mixed-Up Types:\"",{"type":393,"tag":601,"props":1069,"children":1070},{"style":613},[1071],{"type":398,"value":1072},")\n",{"type":393,"tag":601,"props":1074,"children":1075},{"class":603,"line":139},[1076,1080],{"type":393,"tag":601,"props":1077,"children":1078},{"style":1054},[1079],{"type":398,"value":1057},{"type":393,"tag":601,"props":1081,"children":1082},{"style":613},[1083],{"type":398,"value":1084},"(messy_data)\n",{"type":393,"tag":601,"props":1086,"children":1087},{"class":603,"line":148},[1088,1092],{"type":393,"tag":601,"props":1089,"children":1090},{"style":1054},[1091],{"type":398,"value":1057},{"type":393,"tag":601,"props":1093,"children":1094},{"style":613},[1095],{"type":398,"value":1096},"()\n",{"type":393,"tag":601,"props":1098,"children":1099},{"class":603,"line":159},[1100],{"type":393,"tag":601,"props":1101,"children":1102},{"emptyLinePlaceholder":12},[1103],{"type":398,"value":634},{"type":393,"tag":601,"props":1105,"children":1106},{"class":603,"line":168},[1107,1111,1115,1120],{"type":393,"tag":601,"props":1108,"children":1109},{"style":1054},[1110],{"type":398,"value":1057},{"type":393,"tag":601,"props":1112,"children":1113},{"style":613},[1114],{"type":398,"value":1062},{"type":393,"tag":601,"props":1116,"children":1117},{"style":667},[1118],{"type":398,"value":1119},"\"🔍 Current Data Types:\"",{"type":393,"tag":601,"props":1121,"children":1122},{"style":613},[1123],{"type":398,"value":1072},{"type":393,"tag":601,"props":1125,"children":1126},{"class":603,"line":177},[1127,1131],{"type":393,"tag":601,"props":1128,"children":1129},{"style":1054},[1130],{"type":398,"value":1057},{"type":393,"tag":601,"props":1132,"children":1133},{"style":613},[1134],{"type":398,"value":1135},"(messy_data.dtypes)\n",{"type":393,"tag":601,"props":1137,"children":1138},{"class":603,"line":186},[1139,1143],{"type":393,"tag":601,"props":1140,"children":1141},{"style":1054},[1142],{"type":398,"value":1057},{"type":393,"tag":601,"props":1144,"children":1145},{"style":613},[1146],{"type":398,"value":1096},{"type":393,"tag":601,"props":1148,"children":1149},{"class":603,"line":197},[1150],{"type":393,"tag":601,"props":1151,"children":1152},{"emptyLinePlaceholder":12},[1153],{"type":398,"value":634},{"type":393,"tag":601,"props":1155,"children":1156},{"class":603,"line":206},[1157,1161,1165,1170],{"type":393,"tag":601,"props":1158,"children":1159},{"style":1054},[1160],{"type":398,"value":1057},{"type":393,"tag":601,"props":1162,"children":1163},{"style":613},[1164],{"type":398,"value":1062},{"type":393,"tag":601,"props":1166,"children":1167},{"style":667},[1168],{"type":398,"value":1169},"\"Problems:\"",{"type":393,"tag":601,"props":1171,"children":1172},{"style":613},[1173],{"type":398,"value":1072},{"type":393,"tag":601,"props":1175,"children":1176},{"class":603,"line":215},[1177,1181,1185,1190],{"type":393,"tag":601,"props":1178,"children":1179},{"style":1054},[1180],{"type":398,"value":1057},{"type":393,"tag":601,"props":1182,"children":1183},{"style":613},[1184],{"type":398,"value":1062},{"type":393,"tag":601,"props":1186,"children":1187},{"style":667},[1188],{"type":398,"value":1189},"\"- customer_id is text, should be number\"",{"type":393,"tag":601,"props":1191,"children":1192},{"style":613},[1193],{"type":398,"value":1072},{"type":393,"tag":601,"props":1195,"children":1196},{"class":603,"line":224},[1197,1201,1205,1210],{"type":393,"tag":601,"props":1198,"children":1199},{"style":1054},[1200],{"type":398,"value":1057},{"type":393,"tag":601,"props":1202,"children":1203},{"style":613},[1204],{"type":398,"value":1062},{"type":393,"tag":601,"props":1206,"children":1207},{"style":667},[1208],{"type":398,"value":1209},"\"- age is text, should be number\"",{"type":393,"tag":601,"props":1211,"children":1212},{"style":613},[1213],{"type":398,"value":1214},") \n",{"type":393,"tag":601,"props":1216,"children":1217},{"class":603,"line":233},[1218,1222,1226,1231],{"type":393,"tag":601,"props":1219,"children":1220},{"style":1054},[1221],{"type":398,"value":1057},{"type":393,"tag":601,"props":1223,"children":1224},{"style":613},[1225],{"type":398,"value":1062},{"type":393,"tag":601,"props":1227,"children":1228},{"style":667},[1229],{"type":398,"value":1230},"\"- signup_date is text, should be date\"",{"type":393,"tag":601,"props":1232,"children":1233},{"style":613},[1234],{"type":398,"value":1072},{"type":393,"tag":601,"props":1236,"children":1237},{"class":603,"line":244},[1238,1242,1246,1251],{"type":393,"tag":601,"props":1239,"children":1240},{"style":1054},[1241],{"type":398,"value":1057},{"type":393,"tag":601,"props":1243,"children":1244},{"style":613},[1245],{"type":398,"value":1062},{"type":393,"tag":601,"props":1247,"children":1248},{"style":667},[1249],{"type":398,"value":1250},"\"- is_premium is text, should be True/False\"",{"type":393,"tag":601,"props":1252,"children":1253},{"style":613},[1254],{"type":398,"value":1072},{"type":393,"tag":601,"props":1256,"children":1257},{"class":603,"line":253},[1258,1262,1266,1271],{"type":393,"tag":601,"props":1259,"children":1260},{"style":1054},[1261],{"type":398,"value":1057},{"type":393,"tag":601,"props":1263,"children":1264},{"style":613},[1265],{"type":398,"value":1062},{"type":393,"tag":601,"props":1267,"children":1268},{"style":667},[1269],{"type":398,"value":1270},"\"- total_spent is text, should be decimal number\"",{"type":393,"tag":601,"props":1272,"children":1273},{"style":613},[1274],{"type":398,"value":1072},{"type":393,"tag":601,"props":1276,"children":1277},{"class":603,"line":262},[1278,1282],{"type":393,"tag":601,"props":1279,"children":1280},{"style":1054},[1281],{"type":398,"value":1057},{"type":393,"tag":601,"props":1283,"children":1284},{"style":613},[1285],{"type":398,"value":1096},{"type":393,"tag":601,"props":1287,"children":1288},{"class":603,"line":271},[1289],{"type":393,"tag":601,"props":1290,"children":1291},{"emptyLinePlaceholder":12},[1292],{"type":398,"value":634},{"type":393,"tag":601,"props":1294,"children":1295},{"class":603,"line":281},[1296,1300,1304,1309],{"type":393,"tag":601,"props":1297,"children":1298},{"style":1054},[1299],{"type":398,"value":1057},{"type":393,"tag":601,"props":1301,"children":1302},{"style":613},[1303],{"type":398,"value":1062},{"type":393,"tag":601,"props":1305,"children":1306},{"style":667},[1307],{"type":398,"value":1308},"\"Let's fix these types!\"",{"type":393,"tag":601,"props":1310,"children":1311},{"style":613},[1312],{"type":398,"value":1072},{"type":393,"tag":575,"props":1314,"children":1316},{"id":1315},"converting-to-numbers",[1317],{"type":398,"value":1318},"🔢 Converting to Numbers",{"type":393,"tag":401,"props":1320,"children":1321},{},[1322],{"type":398,"value":1323},"Convert text that represents numbers into actual numeric types:",{"type":393,"tag":587,"props":1325,"children":1326},{},[1327],{"type":393,"tag":591,"props":1328,"children":1330},{"className":593,"code":1329,"language":595,"meta":6,"style":6},"import pandas as pd\n\n# Sales data with numbers stored as text\nsales = pd.DataFrame({\n    'product_id': ['101', '102', '103', '104'],\n    'price': ['29.99', '49.95', '19.99', '39.99'],\n    'quantity': ['5', '2', '8', '3'],\n    'discount_percent': ['10', '15', '5', '20']\n})\n\nprint(\"📊 Sales Data (Numbers as Text):\")\nprint(sales)\nprint(\"Data types:\", sales.dtypes.to_dict())\nprint()\n\nprint(\"🔢 Converting to Numbers:\")\nprint()\n\n# Method 1: astype() - when you're sure data is clean\nprint(\"1️⃣ Using astype() for clean conversions:\")\nconverted = sales.copy()\nconverted['product_id'] = converted['product_id'].astype('int')\nconverted['price'] = converted['price'].astype('float')\nconverted['quantity'] = converted['quantity'].astype('int')\nprint(\"Converted data:\")\nprint(converted)\nprint(\"New types:\", converted.dtypes.to_dict())\nprint()\n\n# Method 2: pd.to_numeric() - safer for messy data\nprint(\"2️⃣ Using pd.to_numeric() (safer for real-world data):\")\nsafer_conversion = sales.copy()\nsafer_conversion['product_id'] = pd.to_numeric(safer_conversion['product_id'])\nsafer_conversion['price'] = pd.to_numeric(safer_conversion['price'])\nsafer_conversion['quantity'] = pd.to_numeric(safer_conversion['quantity'])\nprint(\"Safely converted:\")\nprint(safer_conversion.dtypes.to_dict())\n",[1331],{"type":393,"tag":441,"props":1332,"children":1333},{"__ignoreMap":6},[1334,1353,1360,1368,1384,1433,1481,1526,1574,1581,1588,1608,1620,1641,1652,1659,1679,1690,1697,1705,1725,1742,1787,1828,1868,1888,1900,1921,1932,1939,1947,1967,1983,2017,2048,2079,2099],{"type":393,"tag":601,"props":1335,"children":1336},{"class":603,"line":11},[1337,1341,1345,1349],{"type":393,"tag":601,"props":1338,"children":1339},{"style":607},[1340],{"type":398,"value":610},{"type":393,"tag":601,"props":1342,"children":1343},{"style":613},[1344],{"type":398,"value":616},{"type":393,"tag":601,"props":1346,"children":1347},{"style":607},[1348],{"type":398,"value":621},{"type":393,"tag":601,"props":1350,"children":1351},{"style":613},[1352],{"type":398,"value":626},{"type":393,"tag":601,"props":1354,"children":1355},{"class":603,"line":27},[1356],{"type":393,"tag":601,"props":1357,"children":1358},{"emptyLinePlaceholder":12},[1359],{"type":398,"value":634},{"type":393,"tag":601,"props":1361,"children":1362},{"class":603,"line":36},[1363],{"type":393,"tag":601,"props":1364,"children":1365},{"style":640},[1366],{"type":398,"value":1367},"# Sales data with numbers stored as text\n",{"type":393,"tag":601,"props":1369,"children":1370},{"class":603,"line":45},[1371,1376,1380],{"type":393,"tag":601,"props":1372,"children":1373},{"style":613},[1374],{"type":398,"value":1375},"sales ",{"type":393,"tag":601,"props":1377,"children":1378},{"style":607},[1379],{"type":398,"value":656},{"type":393,"tag":601,"props":1381,"children":1382},{"style":613},[1383],{"type":398,"value":661},{"type":393,"tag":601,"props":1385,"children":1386},{"class":603,"line":54},[1387,1392,1396,1401,1405,1410,1414,1419,1423,1428],{"type":393,"tag":601,"props":1388,"children":1389},{"style":667},[1390],{"type":398,"value":1391},"    'product_id'",{"type":393,"tag":601,"props":1393,"children":1394},{"style":613},[1395],{"type":398,"value":675},{"type":393,"tag":601,"props":1397,"children":1398},{"style":667},[1399],{"type":398,"value":1400},"'101'",{"type":393,"tag":601,"props":1402,"children":1403},{"style":613},[1404],{"type":398,"value":685},{"type":393,"tag":601,"props":1406,"children":1407},{"style":667},[1408],{"type":398,"value":1409},"'102'",{"type":393,"tag":601,"props":1411,"children":1412},{"style":613},[1413],{"type":398,"value":685},{"type":393,"tag":601,"props":1415,"children":1416},{"style":667},[1417],{"type":398,"value":1418},"'103'",{"type":393,"tag":601,"props":1420,"children":1421},{"style":613},[1422],{"type":398,"value":685},{"type":393,"tag":601,"props":1424,"children":1425},{"style":667},[1426],{"type":398,"value":1427},"'104'",{"type":393,"tag":601,"props":1429,"children":1430},{"style":613},[1431],{"type":398,"value":1432},"],\n",{"type":393,"tag":601,"props":1434,"children":1435},{"class":603,"line":63},[1436,1441,1445,1450,1454,1459,1463,1468,1472,1477],{"type":393,"tag":601,"props":1437,"children":1438},{"style":667},[1439],{"type":398,"value":1440},"    'price'",{"type":393,"tag":601,"props":1442,"children":1443},{"style":613},[1444],{"type":398,"value":675},{"type":393,"tag":601,"props":1446,"children":1447},{"style":667},[1448],{"type":398,"value":1449},"'29.99'",{"type":393,"tag":601,"props":1451,"children":1452},{"style":613},[1453],{"type":398,"value":685},{"type":393,"tag":601,"props":1455,"children":1456},{"style":667},[1457],{"type":398,"value":1458},"'49.95'",{"type":393,"tag":601,"props":1460,"children":1461},{"style":613},[1462],{"type":398,"value":685},{"type":393,"tag":601,"props":1464,"children":1465},{"style":667},[1466],{"type":398,"value":1467},"'19.99'",{"type":393,"tag":601,"props":1469,"children":1470},{"style":613},[1471],{"type":398,"value":685},{"type":393,"tag":601,"props":1473,"children":1474},{"style":667},[1475],{"type":398,"value":1476},"'39.99'",{"type":393,"tag":601,"props":1478,"children":1479},{"style":613},[1480],{"type":398,"value":1432},{"type":393,"tag":601,"props":1482,"children":1483},{"class":603,"line":72},[1484,1489,1493,1497,1501,1505,1509,1514,1518,1522],{"type":393,"tag":601,"props":1485,"children":1486},{"style":667},[1487],{"type":398,"value":1488},"    'quantity'",{"type":393,"tag":601,"props":1490,"children":1491},{"style":613},[1492],{"type":398,"value":675},{"type":393,"tag":601,"props":1494,"children":1495},{"style":667},[1496],{"type":398,"value":717},{"type":393,"tag":601,"props":1498,"children":1499},{"style":613},[1500],{"type":398,"value":685},{"type":393,"tag":601,"props":1502,"children":1503},{"style":667},[1504],{"type":398,"value":690},{"type":393,"tag":601,"props":1506,"children":1507},{"style":613},[1508],{"type":398,"value":685},{"type":393,"tag":601,"props":1510,"children":1511},{"style":667},[1512],{"type":398,"value":1513},"'8'",{"type":393,"tag":601,"props":1515,"children":1516},{"style":613},[1517],{"type":398,"value":685},{"type":393,"tag":601,"props":1519,"children":1520},{"style":667},[1521],{"type":398,"value":699},{"type":393,"tag":601,"props":1523,"children":1524},{"style":613},[1525],{"type":398,"value":1432},{"type":393,"tag":601,"props":1527,"children":1528},{"class":603,"line":83},[1529,1534,1538,1543,1547,1552,1556,1560,1564,1569],{"type":393,"tag":601,"props":1530,"children":1531},{"style":667},[1532],{"type":398,"value":1533},"    'discount_percent'",{"type":393,"tag":601,"props":1535,"children":1536},{"style":613},[1537],{"type":398,"value":675},{"type":393,"tag":601,"props":1539,"children":1540},{"style":667},[1541],{"type":398,"value":1542},"'10'",{"type":393,"tag":601,"props":1544,"children":1545},{"style":613},[1546],{"type":398,"value":685},{"type":393,"tag":601,"props":1548,"children":1549},{"style":667},[1550],{"type":398,"value":1551},"'15'",{"type":393,"tag":601,"props":1553,"children":1554},{"style":613},[1555],{"type":398,"value":685},{"type":393,"tag":601,"props":1557,"children":1558},{"style":667},[1559],{"type":398,"value":717},{"type":393,"tag":601,"props":1561,"children":1562},{"style":613},[1563],{"type":398,"value":685},{"type":393,"tag":601,"props":1565,"children":1566},{"style":667},[1567],{"type":398,"value":1568},"'20'",{"type":393,"tag":601,"props":1570,"children":1571},{"style":613},[1572],{"type":398,"value":1573},"]\n",{"type":393,"tag":601,"props":1575,"children":1576},{"class":603,"line":92},[1577],{"type":393,"tag":601,"props":1578,"children":1579},{"style":613},[1580],{"type":398,"value":1041},{"type":393,"tag":601,"props":1582,"children":1583},{"class":603,"line":101},[1584],{"type":393,"tag":601,"props":1585,"children":1586},{"emptyLinePlaceholder":12},[1587],{"type":398,"value":634},{"type":393,"tag":601,"props":1589,"children":1590},{"class":603,"line":110},[1591,1595,1599,1604],{"type":393,"tag":601,"props":1592,"children":1593},{"style":1054},[1594],{"type":398,"value":1057},{"type":393,"tag":601,"props":1596,"children":1597},{"style":613},[1598],{"type":398,"value":1062},{"type":393,"tag":601,"props":1600,"children":1601},{"style":667},[1602],{"type":398,"value":1603},"\"📊 Sales Data (Numbers as Text):\"",{"type":393,"tag":601,"props":1605,"children":1606},{"style":613},[1607],{"type":398,"value":1072},{"type":393,"tag":601,"props":1609,"children":1610},{"class":603,"line":121},[1611,1615],{"type":393,"tag":601,"props":1612,"children":1613},{"style":1054},[1614],{"type":398,"value":1057},{"type":393,"tag":601,"props":1616,"children":1617},{"style":613},[1618],{"type":398,"value":1619},"(sales)\n",{"type":393,"tag":601,"props":1621,"children":1622},{"class":603,"line":130},[1623,1627,1631,1636],{"type":393,"tag":601,"props":1624,"children":1625},{"style":1054},[1626],{"type":398,"value":1057},{"type":393,"tag":601,"props":1628,"children":1629},{"style":613},[1630],{"type":398,"value":1062},{"type":393,"tag":601,"props":1632,"children":1633},{"style":667},[1634],{"type":398,"value":1635},"\"Data types:\"",{"type":393,"tag":601,"props":1637,"children":1638},{"style":613},[1639],{"type":398,"value":1640},", sales.dtypes.to_dict())\n",{"type":393,"tag":601,"props":1642,"children":1643},{"class":603,"line":139},[1644,1648],{"type":393,"tag":601,"props":1645,"children":1646},{"style":1054},[1647],{"type":398,"value":1057},{"type":393,"tag":601,"props":1649,"children":1650},{"style":613},[1651],{"type":398,"value":1096},{"type":393,"tag":601,"props":1653,"children":1654},{"class":603,"line":148},[1655],{"type":393,"tag":601,"props":1656,"children":1657},{"emptyLinePlaceholder":12},[1658],{"type":398,"value":634},{"type":393,"tag":601,"props":1660,"children":1661},{"class":603,"line":159},[1662,1666,1670,1675],{"type":393,"tag":601,"props":1663,"children":1664},{"style":1054},[1665],{"type":398,"value":1057},{"type":393,"tag":601,"props":1667,"children":1668},{"style":613},[1669],{"type":398,"value":1062},{"type":393,"tag":601,"props":1671,"children":1672},{"style":667},[1673],{"type":398,"value":1674},"\"🔢 Converting to Numbers:\"",{"type":393,"tag":601,"props":1676,"children":1677},{"style":613},[1678],{"type":398,"value":1072},{"type":393,"tag":601,"props":1680,"children":1681},{"class":603,"line":168},[1682,1686],{"type":393,"tag":601,"props":1683,"children":1684},{"style":1054},[1685],{"type":398,"value":1057},{"type":393,"tag":601,"props":1687,"children":1688},{"style":613},[1689],{"type":398,"value":1096},{"type":393,"tag":601,"props":1691,"children":1692},{"class":603,"line":177},[1693],{"type":393,"tag":601,"props":1694,"children":1695},{"emptyLinePlaceholder":12},[1696],{"type":398,"value":634},{"type":393,"tag":601,"props":1698,"children":1699},{"class":603,"line":186},[1700],{"type":393,"tag":601,"props":1701,"children":1702},{"style":640},[1703],{"type":398,"value":1704},"# Method 1: astype() - when you're sure data is clean\n",{"type":393,"tag":601,"props":1706,"children":1707},{"class":603,"line":197},[1708,1712,1716,1721],{"type":393,"tag":601,"props":1709,"children":1710},{"style":1054},[1711],{"type":398,"value":1057},{"type":393,"tag":601,"props":1713,"children":1714},{"style":613},[1715],{"type":398,"value":1062},{"type":393,"tag":601,"props":1717,"children":1718},{"style":667},[1719],{"type":398,"value":1720},"\"1️⃣ Using astype() for clean conversions:\"",{"type":393,"tag":601,"props":1722,"children":1723},{"style":613},[1724],{"type":398,"value":1072},{"type":393,"tag":601,"props":1726,"children":1727},{"class":603,"line":206},[1728,1733,1737],{"type":393,"tag":601,"props":1729,"children":1730},{"style":613},[1731],{"type":398,"value":1732},"converted ",{"type":393,"tag":601,"props":1734,"children":1735},{"style":607},[1736],{"type":398,"value":656},{"type":393,"tag":601,"props":1738,"children":1739},{"style":613},[1740],{"type":398,"value":1741}," sales.copy()\n",{"type":393,"tag":601,"props":1743,"children":1744},{"class":603,"line":215},[1745,1750,1755,1760,1764,1769,1773,1778,1783],{"type":393,"tag":601,"props":1746,"children":1747},{"style":613},[1748],{"type":398,"value":1749},"converted[",{"type":393,"tag":601,"props":1751,"children":1752},{"style":667},[1753],{"type":398,"value":1754},"'product_id'",{"type":393,"tag":601,"props":1756,"children":1757},{"style":613},[1758],{"type":398,"value":1759},"] ",{"type":393,"tag":601,"props":1761,"children":1762},{"style":607},[1763],{"type":398,"value":656},{"type":393,"tag":601,"props":1765,"children":1766},{"style":613},[1767],{"type":398,"value":1768}," converted[",{"type":393,"tag":601,"props":1770,"children":1771},{"style":667},[1772],{"type":398,"value":1754},{"type":393,"tag":601,"props":1774,"children":1775},{"style":613},[1776],{"type":398,"value":1777},"].astype(",{"type":393,"tag":601,"props":1779,"children":1780},{"style":667},[1781],{"type":398,"value":1782},"'int'",{"type":393,"tag":601,"props":1784,"children":1785},{"style":613},[1786],{"type":398,"value":1072},{"type":393,"tag":601,"props":1788,"children":1789},{"class":603,"line":224},[1790,1794,1799,1803,1807,1811,1815,1819,1824],{"type":393,"tag":601,"props":1791,"children":1792},{"style":613},[1793],{"type":398,"value":1749},{"type":393,"tag":601,"props":1795,"children":1796},{"style":667},[1797],{"type":398,"value":1798},"'price'",{"type":393,"tag":601,"props":1800,"children":1801},{"style":613},[1802],{"type":398,"value":1759},{"type":393,"tag":601,"props":1804,"children":1805},{"style":607},[1806],{"type":398,"value":656},{"type":393,"tag":601,"props":1808,"children":1809},{"style":613},[1810],{"type":398,"value":1768},{"type":393,"tag":601,"props":1812,"children":1813},{"style":667},[1814],{"type":398,"value":1798},{"type":393,"tag":601,"props":1816,"children":1817},{"style":613},[1818],{"type":398,"value":1777},{"type":393,"tag":601,"props":1820,"children":1821},{"style":667},[1822],{"type":398,"value":1823},"'float'",{"type":393,"tag":601,"props":1825,"children":1826},{"style":613},[1827],{"type":398,"value":1072},{"type":393,"tag":601,"props":1829,"children":1830},{"class":603,"line":233},[1831,1835,1840,1844,1848,1852,1856,1860,1864],{"type":393,"tag":601,"props":1832,"children":1833},{"style":613},[1834],{"type":398,"value":1749},{"type":393,"tag":601,"props":1836,"children":1837},{"style":667},[1838],{"type":398,"value":1839},"'quantity'",{"type":393,"tag":601,"props":1841,"children":1842},{"style":613},[1843],{"type":398,"value":1759},{"type":393,"tag":601,"props":1845,"children":1846},{"style":607},[1847],{"type":398,"value":656},{"type":393,"tag":601,"props":1849,"children":1850},{"style":613},[1851],{"type":398,"value":1768},{"type":393,"tag":601,"props":1853,"children":1854},{"style":667},[1855],{"type":398,"value":1839},{"type":393,"tag":601,"props":1857,"children":1858},{"style":613},[1859],{"type":398,"value":1777},{"type":393,"tag":601,"props":1861,"children":1862},{"style":667},[1863],{"type":398,"value":1782},{"type":393,"tag":601,"props":1865,"children":1866},{"style":613},[1867],{"type":398,"value":1072},{"type":393,"tag":601,"props":1869,"children":1870},{"class":603,"line":244},[1871,1875,1879,1884],{"type":393,"tag":601,"props":1872,"children":1873},{"style":1054},[1874],{"type":398,"value":1057},{"type":393,"tag":601,"props":1876,"children":1877},{"style":613},[1878],{"type":398,"value":1062},{"type":393,"tag":601,"props":1880,"children":1881},{"style":667},[1882],{"type":398,"value":1883},"\"Converted data:\"",{"type":393,"tag":601,"props":1885,"children":1886},{"style":613},[1887],{"type":398,"value":1072},{"type":393,"tag":601,"props":1889,"children":1890},{"class":603,"line":253},[1891,1895],{"type":393,"tag":601,"props":1892,"children":1893},{"style":1054},[1894],{"type":398,"value":1057},{"type":393,"tag":601,"props":1896,"children":1897},{"style":613},[1898],{"type":398,"value":1899},"(converted)\n",{"type":393,"tag":601,"props":1901,"children":1902},{"class":603,"line":262},[1903,1907,1911,1916],{"type":393,"tag":601,"props":1904,"children":1905},{"style":1054},[1906],{"type":398,"value":1057},{"type":393,"tag":601,"props":1908,"children":1909},{"style":613},[1910],{"type":398,"value":1062},{"type":393,"tag":601,"props":1912,"children":1913},{"style":667},[1914],{"type":398,"value":1915},"\"New types:\"",{"type":393,"tag":601,"props":1917,"children":1918},{"style":613},[1919],{"type":398,"value":1920},", converted.dtypes.to_dict())\n",{"type":393,"tag":601,"props":1922,"children":1923},{"class":603,"line":271},[1924,1928],{"type":393,"tag":601,"props":1925,"children":1926},{"style":1054},[1927],{"type":398,"value":1057},{"type":393,"tag":601,"props":1929,"children":1930},{"style":613},[1931],{"type":398,"value":1096},{"type":393,"tag":601,"props":1933,"children":1934},{"class":603,"line":281},[1935],{"type":393,"tag":601,"props":1936,"children":1937},{"emptyLinePlaceholder":12},[1938],{"type":398,"value":634},{"type":393,"tag":601,"props":1940,"children":1941},{"class":603,"line":290},[1942],{"type":393,"tag":601,"props":1943,"children":1944},{"style":640},[1945],{"type":398,"value":1946},"# Method 2: pd.to_numeric() - safer for messy data\n",{"type":393,"tag":601,"props":1948,"children":1949},{"class":603,"line":299},[1950,1954,1958,1963],{"type":393,"tag":601,"props":1951,"children":1952},{"style":1054},[1953],{"type":398,"value":1057},{"type":393,"tag":601,"props":1955,"children":1956},{"style":613},[1957],{"type":398,"value":1062},{"type":393,"tag":601,"props":1959,"children":1960},{"style":667},[1961],{"type":398,"value":1962},"\"2️⃣ Using pd.to_numeric() (safer for real-world data):\"",{"type":393,"tag":601,"props":1964,"children":1965},{"style":613},[1966],{"type":398,"value":1072},{"type":393,"tag":601,"props":1968,"children":1969},{"class":603,"line":308},[1970,1975,1979],{"type":393,"tag":601,"props":1971,"children":1972},{"style":613},[1973],{"type":398,"value":1974},"safer_conversion ",{"type":393,"tag":601,"props":1976,"children":1977},{"style":607},[1978],{"type":398,"value":656},{"type":393,"tag":601,"props":1980,"children":1981},{"style":613},[1982],{"type":398,"value":1741},{"type":393,"tag":601,"props":1984,"children":1985},{"class":603,"line":318},[1986,1991,1995,1999,2003,2008,2012],{"type":393,"tag":601,"props":1987,"children":1988},{"style":613},[1989],{"type":398,"value":1990},"safer_conversion[",{"type":393,"tag":601,"props":1992,"children":1993},{"style":667},[1994],{"type":398,"value":1754},{"type":393,"tag":601,"props":1996,"children":1997},{"style":613},[1998],{"type":398,"value":1759},{"type":393,"tag":601,"props":2000,"children":2001},{"style":607},[2002],{"type":398,"value":656},{"type":393,"tag":601,"props":2004,"children":2005},{"style":613},[2006],{"type":398,"value":2007}," pd.to_numeric(safer_conversion[",{"type":393,"tag":601,"props":2009,"children":2010},{"style":667},[2011],{"type":398,"value":1754},{"type":393,"tag":601,"props":2013,"children":2014},{"style":613},[2015],{"type":398,"value":2016},"])\n",{"type":393,"tag":601,"props":2018,"children":2019},{"class":603,"line":327},[2020,2024,2028,2032,2036,2040,2044],{"type":393,"tag":601,"props":2021,"children":2022},{"style":613},[2023],{"type":398,"value":1990},{"type":393,"tag":601,"props":2025,"children":2026},{"style":667},[2027],{"type":398,"value":1798},{"type":393,"tag":601,"props":2029,"children":2030},{"style":613},[2031],{"type":398,"value":1759},{"type":393,"tag":601,"props":2033,"children":2034},{"style":607},[2035],{"type":398,"value":656},{"type":393,"tag":601,"props":2037,"children":2038},{"style":613},[2039],{"type":398,"value":2007},{"type":393,"tag":601,"props":2041,"children":2042},{"style":667},[2043],{"type":398,"value":1798},{"type":393,"tag":601,"props":2045,"children":2046},{"style":613},[2047],{"type":398,"value":2016},{"type":393,"tag":601,"props":2049,"children":2050},{"class":603,"line":336},[2051,2055,2059,2063,2067,2071,2075],{"type":393,"tag":601,"props":2052,"children":2053},{"style":613},[2054],{"type":398,"value":1990},{"type":393,"tag":601,"props":2056,"children":2057},{"style":667},[2058],{"type":398,"value":1839},{"type":393,"tag":601,"props":2060,"children":2061},{"style":613},[2062],{"type":398,"value":1759},{"type":393,"tag":601,"props":2064,"children":2065},{"style":607},[2066],{"type":398,"value":656},{"type":393,"tag":601,"props":2068,"children":2069},{"style":613},[2070],{"type":398,"value":2007},{"type":393,"tag":601,"props":2072,"children":2073},{"style":667},[2074],{"type":398,"value":1839},{"type":393,"tag":601,"props":2076,"children":2077},{"style":613},[2078],{"type":398,"value":2016},{"type":393,"tag":601,"props":2080,"children":2081},{"class":603,"line":346},[2082,2086,2090,2095],{"type":393,"tag":601,"props":2083,"children":2084},{"style":1054},[2085],{"type":398,"value":1057},{"type":393,"tag":601,"props":2087,"children":2088},{"style":613},[2089],{"type":398,"value":1062},{"type":393,"tag":601,"props":2091,"children":2092},{"style":667},[2093],{"type":398,"value":2094},"\"Safely converted:\"",{"type":393,"tag":601,"props":2096,"children":2097},{"style":613},[2098],{"type":398,"value":1072},{"type":393,"tag":601,"props":2100,"children":2101},{"class":603,"line":355},[2102,2106],{"type":393,"tag":601,"props":2103,"children":2104},{"style":1054},[2105],{"type":398,"value":1057},{"type":393,"tag":601,"props":2107,"children":2108},{"style":613},[2109],{"type":398,"value":2110},"(safer_conversion.dtypes.to_dict())\n",{"type":393,"tag":575,"props":2112,"children":2114},{"id":2113},"converting-to-dates",[2115],{"type":398,"value":2116},"📅 Converting to Dates",{"type":393,"tag":401,"props":2118,"children":2119},{},[2120],{"type":398,"value":2121},"Transform text dates into proper datetime objects:",{"type":393,"tag":587,"props":2123,"children":2124},{},[2125],{"type":393,"tag":591,"props":2126,"children":2128},{"className":593,"code":2127,"language":595,"meta":6,"style":6},"import pandas as pd\n\n# Event data with dates as text\nevents = pd.DataFrame({\n    'event_id': [1, 2, 3, 4],\n    'event_name': ['Conference', 'Workshop', 'Seminar', 'Meeting'],\n    'start_date': ['2023-03-15', '2023-04-01', '2023-03-22', '2023-04-10'],\n    'end_date': ['2023-03-16', '2023-04-01', '2023-03-22', '2023-04-10'],\n    'registration_deadline': ['2023-03-01', '2023-03-25', '2023-03-15', '2023-04-05']\n})\n\nprint(\"📊 Event Data (Dates as Text):\")\nprint(events)\nprint(\"Date column types:\", events[['start_date', 'end_date']].dtypes.to_dict())\nprint()\n\nprint(\"📅 Converting to Dates:\")\nprint()\n\nprint(\"1️⃣ Convert start_date to datetime:\")\nevents['start_date'] = pd.to_datetime(events['start_date'])\nprint(\"start_date type:\", events['start_date'].dtype)\nprint(events['start_date'])\nprint()\n\nprint(\"2️⃣ Convert multiple date columns:\")\ndate_columns = ['end_date', 'registration_deadline']\nfor col in date_columns:\n    events[col] = pd.to_datetime(events[col])\n\nprint(\"All date types:\")\nprint(events.dtypes)\nprint()\n\nprint(\"3️⃣ Now we can do date operations:\")\nevents['days_until_event'] = (events['start_date'] - pd.Timestamp.now()).dt.days\nevents['event_duration'] = (events['end_date'] - events['start_date']).dt.days + 1\nprint(\"Date calculations:\")\nprint(events[['event_name', 'start_date', 'event_duration']])\n",[2129],{"type":393,"tag":441,"props":2130,"children":2131},{"__ignoreMap":6},[2132,2151,2158,2166,2182,2230,2278,2326,2371,2418,2425,2432,2452,2464,2504,2515,2522,2542,2553,2560,2580,2613,2643,2663,2674,2681,2701,2735,2758,2775,2782,2802,2814,2825,2832,2852,2895,2955,2975],{"type":393,"tag":601,"props":2133,"children":2134},{"class":603,"line":11},[2135,2139,2143,2147],{"type":393,"tag":601,"props":2136,"children":2137},{"style":607},[2138],{"type":398,"value":610},{"type":393,"tag":601,"props":2140,"children":2141},{"style":613},[2142],{"type":398,"value":616},{"type":393,"tag":601,"props":2144,"children":2145},{"style":607},[2146],{"type":398,"value":621},{"type":393,"tag":601,"props":2148,"children":2149},{"style":613},[2150],{"type":398,"value":626},{"type":393,"tag":601,"props":2152,"children":2153},{"class":603,"line":27},[2154],{"type":393,"tag":601,"props":2155,"children":2156},{"emptyLinePlaceholder":12},[2157],{"type":398,"value":634},{"type":393,"tag":601,"props":2159,"children":2160},{"class":603,"line":36},[2161],{"type":393,"tag":601,"props":2162,"children":2163},{"style":640},[2164],{"type":398,"value":2165},"# Event data with dates as text\n",{"type":393,"tag":601,"props":2167,"children":2168},{"class":603,"line":45},[2169,2174,2178],{"type":393,"tag":601,"props":2170,"children":2171},{"style":613},[2172],{"type":398,"value":2173},"events ",{"type":393,"tag":601,"props":2175,"children":2176},{"style":607},[2177],{"type":398,"value":656},{"type":393,"tag":601,"props":2179,"children":2180},{"style":613},[2181],{"type":398,"value":661},{"type":393,"tag":601,"props":2183,"children":2184},{"class":603,"line":54},[2185,2190,2194,2199,2203,2208,2212,2217,2221,2226],{"type":393,"tag":601,"props":2186,"children":2187},{"style":667},[2188],{"type":398,"value":2189},"    'event_id'",{"type":393,"tag":601,"props":2191,"children":2192},{"style":613},[2193],{"type":398,"value":675},{"type":393,"tag":601,"props":2195,"children":2196},{"style":1054},[2197],{"type":398,"value":2198},"1",{"type":393,"tag":601,"props":2200,"children":2201},{"style":613},[2202],{"type":398,"value":685},{"type":393,"tag":601,"props":2204,"children":2205},{"style":1054},[2206],{"type":398,"value":2207},"2",{"type":393,"tag":601,"props":2209,"children":2210},{"style":613},[2211],{"type":398,"value":685},{"type":393,"tag":601,"props":2213,"children":2214},{"style":1054},[2215],{"type":398,"value":2216},"3",{"type":393,"tag":601,"props":2218,"children":2219},{"style":613},[2220],{"type":398,"value":685},{"type":393,"tag":601,"props":2222,"children":2223},{"style":1054},[2224],{"type":398,"value":2225},"4",{"type":393,"tag":601,"props":2227,"children":2228},{"style":613},[2229],{"type":398,"value":1432},{"type":393,"tag":601,"props":2231,"children":2232},{"class":603,"line":63},[2233,2238,2242,2247,2251,2256,2260,2265,2269,2274],{"type":393,"tag":601,"props":2234,"children":2235},{"style":667},[2236],{"type":398,"value":2237},"    'event_name'",{"type":393,"tag":601,"props":2239,"children":2240},{"style":613},[2241],{"type":398,"value":675},{"type":393,"tag":601,"props":2243,"children":2244},{"style":667},[2245],{"type":398,"value":2246},"'Conference'",{"type":393,"tag":601,"props":2248,"children":2249},{"style":613},[2250],{"type":398,"value":685},{"type":393,"tag":601,"props":2252,"children":2253},{"style":667},[2254],{"type":398,"value":2255},"'Workshop'",{"type":393,"tag":601,"props":2257,"children":2258},{"style":613},[2259],{"type":398,"value":685},{"type":393,"tag":601,"props":2261,"children":2262},{"style":667},[2263],{"type":398,"value":2264},"'Seminar'",{"type":393,"tag":601,"props":2266,"children":2267},{"style":613},[2268],{"type":398,"value":685},{"type":393,"tag":601,"props":2270,"children":2271},{"style":667},[2272],{"type":398,"value":2273},"'Meeting'",{"type":393,"tag":601,"props":2275,"children":2276},{"style":613},[2277],{"type":398,"value":1432},{"type":393,"tag":601,"props":2279,"children":2280},{"class":603,"line":72},[2281,2286,2290,2295,2299,2304,2308,2313,2317,2322],{"type":393,"tag":601,"props":2282,"children":2283},{"style":667},[2284],{"type":398,"value":2285},"    'start_date'",{"type":393,"tag":601,"props":2287,"children":2288},{"style":613},[2289],{"type":398,"value":675},{"type":393,"tag":601,"props":2291,"children":2292},{"style":667},[2293],{"type":398,"value":2294},"'2023-03-15'",{"type":393,"tag":601,"props":2296,"children":2297},{"style":613},[2298],{"type":398,"value":685},{"type":393,"tag":601,"props":2300,"children":2301},{"style":667},[2302],{"type":398,"value":2303},"'2023-04-01'",{"type":393,"tag":601,"props":2305,"children":2306},{"style":613},[2307],{"type":398,"value":685},{"type":393,"tag":601,"props":2309,"children":2310},{"style":667},[2311],{"type":398,"value":2312},"'2023-03-22'",{"type":393,"tag":601,"props":2314,"children":2315},{"style":613},[2316],{"type":398,"value":685},{"type":393,"tag":601,"props":2318,"children":2319},{"style":667},[2320],{"type":398,"value":2321},"'2023-04-10'",{"type":393,"tag":601,"props":2323,"children":2324},{"style":613},[2325],{"type":398,"value":1432},{"type":393,"tag":601,"props":2327,"children":2328},{"class":603,"line":83},[2329,2334,2338,2343,2347,2351,2355,2359,2363,2367],{"type":393,"tag":601,"props":2330,"children":2331},{"style":667},[2332],{"type":398,"value":2333},"    'end_date'",{"type":393,"tag":601,"props":2335,"children":2336},{"style":613},[2337],{"type":398,"value":675},{"type":393,"tag":601,"props":2339,"children":2340},{"style":667},[2341],{"type":398,"value":2342},"'2023-03-16'",{"type":393,"tag":601,"props":2344,"children":2345},{"style":613},[2346],{"type":398,"value":685},{"type":393,"tag":601,"props":2348,"children":2349},{"style":667},[2350],{"type":398,"value":2303},{"type":393,"tag":601,"props":2352,"children":2353},{"style":613},[2354],{"type":398,"value":685},{"type":393,"tag":601,"props":2356,"children":2357},{"style":667},[2358],{"type":398,"value":2312},{"type":393,"tag":601,"props":2360,"children":2361},{"style":613},[2362],{"type":398,"value":685},{"type":393,"tag":601,"props":2364,"children":2365},{"style":667},[2366],{"type":398,"value":2321},{"type":393,"tag":601,"props":2368,"children":2369},{"style":613},[2370],{"type":398,"value":1432},{"type":393,"tag":601,"props":2372,"children":2373},{"class":603,"line":92},[2374,2379,2383,2388,2392,2397,2401,2405,2409,2414],{"type":393,"tag":601,"props":2375,"children":2376},{"style":667},[2377],{"type":398,"value":2378},"    'registration_deadline'",{"type":393,"tag":601,"props":2380,"children":2381},{"style":613},[2382],{"type":398,"value":675},{"type":393,"tag":601,"props":2384,"children":2385},{"style":667},[2386],{"type":398,"value":2387},"'2023-03-01'",{"type":393,"tag":601,"props":2389,"children":2390},{"style":613},[2391],{"type":398,"value":685},{"type":393,"tag":601,"props":2393,"children":2394},{"style":667},[2395],{"type":398,"value":2396},"'2023-03-25'",{"type":393,"tag":601,"props":2398,"children":2399},{"style":613},[2400],{"type":398,"value":685},{"type":393,"tag":601,"props":2402,"children":2403},{"style":667},[2404],{"type":398,"value":2294},{"type":393,"tag":601,"props":2406,"children":2407},{"style":613},[2408],{"type":398,"value":685},{"type":393,"tag":601,"props":2410,"children":2411},{"style":667},[2412],{"type":398,"value":2413},"'2023-04-05'",{"type":393,"tag":601,"props":2415,"children":2416},{"style":613},[2417],{"type":398,"value":1573},{"type":393,"tag":601,"props":2419,"children":2420},{"class":603,"line":101},[2421],{"type":393,"tag":601,"props":2422,"children":2423},{"style":613},[2424],{"type":398,"value":1041},{"type":393,"tag":601,"props":2426,"children":2427},{"class":603,"line":110},[2428],{"type":393,"tag":601,"props":2429,"children":2430},{"emptyLinePlaceholder":12},[2431],{"type":398,"value":634},{"type":393,"tag":601,"props":2433,"children":2434},{"class":603,"line":121},[2435,2439,2443,2448],{"type":393,"tag":601,"props":2436,"children":2437},{"style":1054},[2438],{"type":398,"value":1057},{"type":393,"tag":601,"props":2440,"children":2441},{"style":613},[2442],{"type":398,"value":1062},{"type":393,"tag":601,"props":2444,"children":2445},{"style":667},[2446],{"type":398,"value":2447},"\"📊 Event Data (Dates as Text):\"",{"type":393,"tag":601,"props":2449,"children":2450},{"style":613},[2451],{"type":398,"value":1072},{"type":393,"tag":601,"props":2453,"children":2454},{"class":603,"line":130},[2455,2459],{"type":393,"tag":601,"props":2456,"children":2457},{"style":1054},[2458],{"type":398,"value":1057},{"type":393,"tag":601,"props":2460,"children":2461},{"style":613},[2462],{"type":398,"value":2463},"(events)\n",{"type":393,"tag":601,"props":2465,"children":2466},{"class":603,"line":139},[2467,2471,2475,2480,2485,2490,2494,2499],{"type":393,"tag":601,"props":2468,"children":2469},{"style":1054},[2470],{"type":398,"value":1057},{"type":393,"tag":601,"props":2472,"children":2473},{"style":613},[2474],{"type":398,"value":1062},{"type":393,"tag":601,"props":2476,"children":2477},{"style":667},[2478],{"type":398,"value":2479},"\"Date column types:\"",{"type":393,"tag":601,"props":2481,"children":2482},{"style":613},[2483],{"type":398,"value":2484},", events[[",{"type":393,"tag":601,"props":2486,"children":2487},{"style":667},[2488],{"type":398,"value":2489},"'start_date'",{"type":393,"tag":601,"props":2491,"children":2492},{"style":613},[2493],{"type":398,"value":685},{"type":393,"tag":601,"props":2495,"children":2496},{"style":667},[2497],{"type":398,"value":2498},"'end_date'",{"type":393,"tag":601,"props":2500,"children":2501},{"style":613},[2502],{"type":398,"value":2503},"]].dtypes.to_dict())\n",{"type":393,"tag":601,"props":2505,"children":2506},{"class":603,"line":148},[2507,2511],{"type":393,"tag":601,"props":2508,"children":2509},{"style":1054},[2510],{"type":398,"value":1057},{"type":393,"tag":601,"props":2512,"children":2513},{"style":613},[2514],{"type":398,"value":1096},{"type":393,"tag":601,"props":2516,"children":2517},{"class":603,"line":159},[2518],{"type":393,"tag":601,"props":2519,"children":2520},{"emptyLinePlaceholder":12},[2521],{"type":398,"value":634},{"type":393,"tag":601,"props":2523,"children":2524},{"class":603,"line":168},[2525,2529,2533,2538],{"type":393,"tag":601,"props":2526,"children":2527},{"style":1054},[2528],{"type":398,"value":1057},{"type":393,"tag":601,"props":2530,"children":2531},{"style":613},[2532],{"type":398,"value":1062},{"type":393,"tag":601,"props":2534,"children":2535},{"style":667},[2536],{"type":398,"value":2537},"\"📅 Converting to Dates:\"",{"type":393,"tag":601,"props":2539,"children":2540},{"style":613},[2541],{"type":398,"value":1072},{"type":393,"tag":601,"props":2543,"children":2544},{"class":603,"line":177},[2545,2549],{"type":393,"tag":601,"props":2546,"children":2547},{"style":1054},[2548],{"type":398,"value":1057},{"type":393,"tag":601,"props":2550,"children":2551},{"style":613},[2552],{"type":398,"value":1096},{"type":393,"tag":601,"props":2554,"children":2555},{"class":603,"line":186},[2556],{"type":393,"tag":601,"props":2557,"children":2558},{"emptyLinePlaceholder":12},[2559],{"type":398,"value":634},{"type":393,"tag":601,"props":2561,"children":2562},{"class":603,"line":197},[2563,2567,2571,2576],{"type":393,"tag":601,"props":2564,"children":2565},{"style":1054},[2566],{"type":398,"value":1057},{"type":393,"tag":601,"props":2568,"children":2569},{"style":613},[2570],{"type":398,"value":1062},{"type":393,"tag":601,"props":2572,"children":2573},{"style":667},[2574],{"type":398,"value":2575},"\"1️⃣ Convert start_date to datetime:\"",{"type":393,"tag":601,"props":2577,"children":2578},{"style":613},[2579],{"type":398,"value":1072},{"type":393,"tag":601,"props":2581,"children":2582},{"class":603,"line":206},[2583,2588,2592,2596,2600,2605,2609],{"type":393,"tag":601,"props":2584,"children":2585},{"style":613},[2586],{"type":398,"value":2587},"events[",{"type":393,"tag":601,"props":2589,"children":2590},{"style":667},[2591],{"type":398,"value":2489},{"type":393,"tag":601,"props":2593,"children":2594},{"style":613},[2595],{"type":398,"value":1759},{"type":393,"tag":601,"props":2597,"children":2598},{"style":607},[2599],{"type":398,"value":656},{"type":393,"tag":601,"props":2601,"children":2602},{"style":613},[2603],{"type":398,"value":2604}," pd.to_datetime(events[",{"type":393,"tag":601,"props":2606,"children":2607},{"style":667},[2608],{"type":398,"value":2489},{"type":393,"tag":601,"props":2610,"children":2611},{"style":613},[2612],{"type":398,"value":2016},{"type":393,"tag":601,"props":2614,"children":2615},{"class":603,"line":215},[2616,2620,2624,2629,2634,2638],{"type":393,"tag":601,"props":2617,"children":2618},{"style":1054},[2619],{"type":398,"value":1057},{"type":393,"tag":601,"props":2621,"children":2622},{"style":613},[2623],{"type":398,"value":1062},{"type":393,"tag":601,"props":2625,"children":2626},{"style":667},[2627],{"type":398,"value":2628},"\"start_date type:\"",{"type":393,"tag":601,"props":2630,"children":2631},{"style":613},[2632],{"type":398,"value":2633},", events[",{"type":393,"tag":601,"props":2635,"children":2636},{"style":667},[2637],{"type":398,"value":2489},{"type":393,"tag":601,"props":2639,"children":2640},{"style":613},[2641],{"type":398,"value":2642},"].dtype)\n",{"type":393,"tag":601,"props":2644,"children":2645},{"class":603,"line":224},[2646,2650,2655,2659],{"type":393,"tag":601,"props":2647,"children":2648},{"style":1054},[2649],{"type":398,"value":1057},{"type":393,"tag":601,"props":2651,"children":2652},{"style":613},[2653],{"type":398,"value":2654},"(events[",{"type":393,"tag":601,"props":2656,"children":2657},{"style":667},[2658],{"type":398,"value":2489},{"type":393,"tag":601,"props":2660,"children":2661},{"style":613},[2662],{"type":398,"value":2016},{"type":393,"tag":601,"props":2664,"children":2665},{"class":603,"line":233},[2666,2670],{"type":393,"tag":601,"props":2667,"children":2668},{"style":1054},[2669],{"type":398,"value":1057},{"type":393,"tag":601,"props":2671,"children":2672},{"style":613},[2673],{"type":398,"value":1096},{"type":393,"tag":601,"props":2675,"children":2676},{"class":603,"line":244},[2677],{"type":393,"tag":601,"props":2678,"children":2679},{"emptyLinePlaceholder":12},[2680],{"type":398,"value":634},{"type":393,"tag":601,"props":2682,"children":2683},{"class":603,"line":253},[2684,2688,2692,2697],{"type":393,"tag":601,"props":2685,"children":2686},{"style":1054},[2687],{"type":398,"value":1057},{"type":393,"tag":601,"props":2689,"children":2690},{"style":613},[2691],{"type":398,"value":1062},{"type":393,"tag":601,"props":2693,"children":2694},{"style":667},[2695],{"type":398,"value":2696},"\"2️⃣ Convert multiple date columns:\"",{"type":393,"tag":601,"props":2698,"children":2699},{"style":613},[2700],{"type":398,"value":1072},{"type":393,"tag":601,"props":2702,"children":2703},{"class":603,"line":262},[2704,2709,2713,2718,2722,2726,2731],{"type":393,"tag":601,"props":2705,"children":2706},{"style":613},[2707],{"type":398,"value":2708},"date_columns ",{"type":393,"tag":601,"props":2710,"children":2711},{"style":607},[2712],{"type":398,"value":656},{"type":393,"tag":601,"props":2714,"children":2715},{"style":613},[2716],{"type":398,"value":2717}," [",{"type":393,"tag":601,"props":2719,"children":2720},{"style":667},[2721],{"type":398,"value":2498},{"type":393,"tag":601,"props":2723,"children":2724},{"style":613},[2725],{"type":398,"value":685},{"type":393,"tag":601,"props":2727,"children":2728},{"style":667},[2729],{"type":398,"value":2730},"'registration_deadline'",{"type":393,"tag":601,"props":2732,"children":2733},{"style":613},[2734],{"type":398,"value":1573},{"type":393,"tag":601,"props":2736,"children":2737},{"class":603,"line":271},[2738,2743,2748,2753],{"type":393,"tag":601,"props":2739,"children":2740},{"style":607},[2741],{"type":398,"value":2742},"for",{"type":393,"tag":601,"props":2744,"children":2745},{"style":613},[2746],{"type":398,"value":2747}," col ",{"type":393,"tag":601,"props":2749,"children":2750},{"style":607},[2751],{"type":398,"value":2752},"in",{"type":393,"tag":601,"props":2754,"children":2755},{"style":613},[2756],{"type":398,"value":2757}," date_columns:\n",{"type":393,"tag":601,"props":2759,"children":2760},{"class":603,"line":281},[2761,2766,2770],{"type":393,"tag":601,"props":2762,"children":2763},{"style":613},[2764],{"type":398,"value":2765},"    events[col] ",{"type":393,"tag":601,"props":2767,"children":2768},{"style":607},[2769],{"type":398,"value":656},{"type":393,"tag":601,"props":2771,"children":2772},{"style":613},[2773],{"type":398,"value":2774}," pd.to_datetime(events[col])\n",{"type":393,"tag":601,"props":2776,"children":2777},{"class":603,"line":290},[2778],{"type":393,"tag":601,"props":2779,"children":2780},{"emptyLinePlaceholder":12},[2781],{"type":398,"value":634},{"type":393,"tag":601,"props":2783,"children":2784},{"class":603,"line":299},[2785,2789,2793,2798],{"type":393,"tag":601,"props":2786,"children":2787},{"style":1054},[2788],{"type":398,"value":1057},{"type":393,"tag":601,"props":2790,"children":2791},{"style":613},[2792],{"type":398,"value":1062},{"type":393,"tag":601,"props":2794,"children":2795},{"style":667},[2796],{"type":398,"value":2797},"\"All date types:\"",{"type":393,"tag":601,"props":2799,"children":2800},{"style":613},[2801],{"type":398,"value":1072},{"type":393,"tag":601,"props":2803,"children":2804},{"class":603,"line":308},[2805,2809],{"type":393,"tag":601,"props":2806,"children":2807},{"style":1054},[2808],{"type":398,"value":1057},{"type":393,"tag":601,"props":2810,"children":2811},{"style":613},[2812],{"type":398,"value":2813},"(events.dtypes)\n",{"type":393,"tag":601,"props":2815,"children":2816},{"class":603,"line":318},[2817,2821],{"type":393,"tag":601,"props":2818,"children":2819},{"style":1054},[2820],{"type":398,"value":1057},{"type":393,"tag":601,"props":2822,"children":2823},{"style":613},[2824],{"type":398,"value":1096},{"type":393,"tag":601,"props":2826,"children":2827},{"class":603,"line":327},[2828],{"type":393,"tag":601,"props":2829,"children":2830},{"emptyLinePlaceholder":12},[2831],{"type":398,"value":634},{"type":393,"tag":601,"props":2833,"children":2834},{"class":603,"line":336},[2835,2839,2843,2848],{"type":393,"tag":601,"props":2836,"children":2837},{"style":1054},[2838],{"type":398,"value":1057},{"type":393,"tag":601,"props":2840,"children":2841},{"style":613},[2842],{"type":398,"value":1062},{"type":393,"tag":601,"props":2844,"children":2845},{"style":667},[2846],{"type":398,"value":2847},"\"3️⃣ Now we can do date operations:\"",{"type":393,"tag":601,"props":2849,"children":2850},{"style":613},[2851],{"type":398,"value":1072},{"type":393,"tag":601,"props":2853,"children":2854},{"class":603,"line":346},[2855,2859,2864,2868,2872,2877,2881,2885,2890],{"type":393,"tag":601,"props":2856,"children":2857},{"style":613},[2858],{"type":398,"value":2587},{"type":393,"tag":601,"props":2860,"children":2861},{"style":667},[2862],{"type":398,"value":2863},"'days_until_event'",{"type":393,"tag":601,"props":2865,"children":2866},{"style":613},[2867],{"type":398,"value":1759},{"type":393,"tag":601,"props":2869,"children":2870},{"style":607},[2871],{"type":398,"value":656},{"type":393,"tag":601,"props":2873,"children":2874},{"style":613},[2875],{"type":398,"value":2876}," (events[",{"type":393,"tag":601,"props":2878,"children":2879},{"style":667},[2880],{"type":398,"value":2489},{"type":393,"tag":601,"props":2882,"children":2883},{"style":613},[2884],{"type":398,"value":1759},{"type":393,"tag":601,"props":2886,"children":2887},{"style":607},[2888],{"type":398,"value":2889},"-",{"type":393,"tag":601,"props":2891,"children":2892},{"style":613},[2893],{"type":398,"value":2894}," pd.Timestamp.now()).dt.days\n",{"type":393,"tag":601,"props":2896,"children":2897},{"class":603,"line":355},[2898,2902,2907,2911,2915,2919,2923,2927,2931,2936,2940,2945,2950],{"type":393,"tag":601,"props":2899,"children":2900},{"style":613},[2901],{"type":398,"value":2587},{"type":393,"tag":601,"props":2903,"children":2904},{"style":667},[2905],{"type":398,"value":2906},"'event_duration'",{"type":393,"tag":601,"props":2908,"children":2909},{"style":613},[2910],{"type":398,"value":1759},{"type":393,"tag":601,"props":2912,"children":2913},{"style":607},[2914],{"type":398,"value":656},{"type":393,"tag":601,"props":2916,"children":2917},{"style":613},[2918],{"type":398,"value":2876},{"type":393,"tag":601,"props":2920,"children":2921},{"style":667},[2922],{"type":398,"value":2498},{"type":393,"tag":601,"props":2924,"children":2925},{"style":613},[2926],{"type":398,"value":1759},{"type":393,"tag":601,"props":2928,"children":2929},{"style":607},[2930],{"type":398,"value":2889},{"type":393,"tag":601,"props":2932,"children":2933},{"style":613},[2934],{"type":398,"value":2935}," events[",{"type":393,"tag":601,"props":2937,"children":2938},{"style":667},[2939],{"type":398,"value":2489},{"type":393,"tag":601,"props":2941,"children":2942},{"style":613},[2943],{"type":398,"value":2944},"]).dt.days ",{"type":393,"tag":601,"props":2946,"children":2947},{"style":607},[2948],{"type":398,"value":2949},"+",{"type":393,"tag":601,"props":2951,"children":2952},{"style":1054},[2953],{"type":398,"value":2954}," 1\n",{"type":393,"tag":601,"props":2956,"children":2957},{"class":603,"line":364},[2958,2962,2966,2971],{"type":393,"tag":601,"props":2959,"children":2960},{"style":1054},[2961],{"type":398,"value":1057},{"type":393,"tag":601,"props":2963,"children":2964},{"style":613},[2965],{"type":398,"value":1062},{"type":393,"tag":601,"props":2967,"children":2968},{"style":667},[2969],{"type":398,"value":2970},"\"Date calculations:\"",{"type":393,"tag":601,"props":2972,"children":2973},{"style":613},[2974],{"type":398,"value":1072},{"type":393,"tag":601,"props":2976,"children":2977},{"class":603,"line":374},[2978,2982,2987,2992,2996,3000,3004,3008],{"type":393,"tag":601,"props":2979,"children":2980},{"style":1054},[2981],{"type":398,"value":1057},{"type":393,"tag":601,"props":2983,"children":2984},{"style":613},[2985],{"type":398,"value":2986},"(events[[",{"type":393,"tag":601,"props":2988,"children":2989},{"style":667},[2990],{"type":398,"value":2991},"'event_name'",{"type":393,"tag":601,"props":2993,"children":2994},{"style":613},[2995],{"type":398,"value":685},{"type":393,"tag":601,"props":2997,"children":2998},{"style":667},[2999],{"type":398,"value":2489},{"type":393,"tag":601,"props":3001,"children":3002},{"style":613},[3003],{"type":398,"value":685},{"type":393,"tag":601,"props":3005,"children":3006},{"style":667},[3007],{"type":398,"value":2906},{"type":393,"tag":601,"props":3009,"children":3010},{"style":613},[3011],{"type":398,"value":3012},"]])\n",{"type":393,"tag":575,"props":3014,"children":3016},{"id":3015},"converting-to-boolean",[3017],{"type":398,"value":3018},"✅ Converting to Boolean",{"type":393,"tag":401,"props":3020,"children":3021},{},[3022],{"type":398,"value":3023},"Transform Yes/No, True/False text into actual boolean values:",{"type":393,"tag":587,"props":3025,"children":3026},{},[3027],{"type":393,"tag":591,"props":3028,"children":3030},{"className":593,"code":3029,"language":595,"meta":6,"style":6},"import pandas as pd\n\n# Survey data with boolean values as text\nsurvey = pd.DataFrame({\n    'respondent_id': [1, 2, 3, 4, 5],\n    'satisfied': ['Yes', 'No', 'Yes', 'Yes', 'No'],\n    'would_recommend': ['True', 'False', 'True', 'False', 'True'],\n    'completed_survey': ['1', '0', '1', '1', '0'],\n    'opted_in_emails': ['y', 'n', 'Y', 'N', 'y']\n})\n\nprint(\"📊 Survey Data (Booleans as Text):\")\nprint(survey)\nprint()\n\nprint(\"✅ Converting to Boolean:\")\nprint()\n\nprint(\"1️⃣ Yes/No to True/False:\")\nsurvey['satisfied'] = survey['satisfied'].map({'Yes': True, 'No': False})\nprint(\"Satisfied column:\")\nprint(survey['satisfied'])\nprint()\n\nprint(\"2️⃣ True/False strings to boolean:\")\nsurvey['would_recommend'] = survey['would_recommend'] == 'True'\nprint(\"Would recommend column:\")\nprint(survey['would_recommend'])\nprint()\n\nprint(\"3️⃣ 1/0 to True/False:\")\nsurvey['completed_survey'] = survey['completed_survey'].astype('bool')\nprint(\"Completed survey column:\")\nprint(survey['completed_survey'])\nprint()\n\nprint(\"4️⃣ y/n variations to boolean:\")\nsurvey['opted_in_emails'] = survey['opted_in_emails'].str.lower().isin(['y', 'yes'])\nprint(\"Opted in emails column:\")\nprint(survey['opted_in_emails'])\nprint()\n\nprint(\"Final data with proper boolean types:\")\nprint(survey.dtypes)\n",[3031],{"type":393,"tag":441,"props":3032,"children":3033},{"__ignoreMap":6},[3034,3053,3060,3068,3084,3137,3191,3243,3296,3352,3359,3366,3386,3398,3409,3416,3436,3447,3454,3474,3543,3563,3583,3594,3601,3621,3663,3683,3702,3713,3720,3740,3781,3801,3820,3831,3838,3858,3908,3928,3947,3959,3967,3988],{"type":393,"tag":601,"props":3035,"children":3036},{"class":603,"line":11},[3037,3041,3045,3049],{"type":393,"tag":601,"props":3038,"children":3039},{"style":607},[3040],{"type":398,"value":610},{"type":393,"tag":601,"props":3042,"children":3043},{"style":613},[3044],{"type":398,"value":616},{"type":393,"tag":601,"props":3046,"children":3047},{"style":607},[3048],{"type":398,"value":621},{"type":393,"tag":601,"props":3050,"children":3051},{"style":613},[3052],{"type":398,"value":626},{"type":393,"tag":601,"props":3054,"children":3055},{"class":603,"line":27},[3056],{"type":393,"tag":601,"props":3057,"children":3058},{"emptyLinePlaceholder":12},[3059],{"type":398,"value":634},{"type":393,"tag":601,"props":3061,"children":3062},{"class":603,"line":36},[3063],{"type":393,"tag":601,"props":3064,"children":3065},{"style":640},[3066],{"type":398,"value":3067},"# Survey data with boolean values as text\n",{"type":393,"tag":601,"props":3069,"children":3070},{"class":603,"line":45},[3071,3076,3080],{"type":393,"tag":601,"props":3072,"children":3073},{"style":613},[3074],{"type":398,"value":3075},"survey ",{"type":393,"tag":601,"props":3077,"children":3078},{"style":607},[3079],{"type":398,"value":656},{"type":393,"tag":601,"props":3081,"children":3082},{"style":613},[3083],{"type":398,"value":661},{"type":393,"tag":601,"props":3085,"children":3086},{"class":603,"line":54},[3087,3092,3096,3100,3104,3108,3112,3116,3120,3124,3128,3133],{"type":393,"tag":601,"props":3088,"children":3089},{"style":667},[3090],{"type":398,"value":3091},"    'respondent_id'",{"type":393,"tag":601,"props":3093,"children":3094},{"style":613},[3095],{"type":398,"value":675},{"type":393,"tag":601,"props":3097,"children":3098},{"style":1054},[3099],{"type":398,"value":2198},{"type":393,"tag":601,"props":3101,"children":3102},{"style":613},[3103],{"type":398,"value":685},{"type":393,"tag":601,"props":3105,"children":3106},{"style":1054},[3107],{"type":398,"value":2207},{"type":393,"tag":601,"props":3109,"children":3110},{"style":613},[3111],{"type":398,"value":685},{"type":393,"tag":601,"props":3113,"children":3114},{"style":1054},[3115],{"type":398,"value":2216},{"type":393,"tag":601,"props":3117,"children":3118},{"style":613},[3119],{"type":398,"value":685},{"type":393,"tag":601,"props":3121,"children":3122},{"style":1054},[3123],{"type":398,"value":2225},{"type":393,"tag":601,"props":3125,"children":3126},{"style":613},[3127],{"type":398,"value":685},{"type":393,"tag":601,"props":3129,"children":3130},{"style":1054},[3131],{"type":398,"value":3132},"5",{"type":393,"tag":601,"props":3134,"children":3135},{"style":613},[3136],{"type":398,"value":1432},{"type":393,"tag":601,"props":3138,"children":3139},{"class":603,"line":63},[3140,3145,3149,3154,3158,3163,3167,3171,3175,3179,3183,3187],{"type":393,"tag":601,"props":3141,"children":3142},{"style":667},[3143],{"type":398,"value":3144},"    'satisfied'",{"type":393,"tag":601,"props":3146,"children":3147},{"style":613},[3148],{"type":398,"value":675},{"type":393,"tag":601,"props":3150,"children":3151},{"style":667},[3152],{"type":398,"value":3153},"'Yes'",{"type":393,"tag":601,"props":3155,"children":3156},{"style":613},[3157],{"type":398,"value":685},{"type":393,"tag":601,"props":3159,"children":3160},{"style":667},[3161],{"type":398,"value":3162},"'No'",{"type":393,"tag":601,"props":3164,"children":3165},{"style":613},[3166],{"type":398,"value":685},{"type":393,"tag":601,"props":3168,"children":3169},{"style":667},[3170],{"type":398,"value":3153},{"type":393,"tag":601,"props":3172,"children":3173},{"style":613},[3174],{"type":398,"value":685},{"type":393,"tag":601,"props":3176,"children":3177},{"style":667},[3178],{"type":398,"value":3153},{"type":393,"tag":601,"props":3180,"children":3181},{"style":613},[3182],{"type":398,"value":685},{"type":393,"tag":601,"props":3184,"children":3185},{"style":667},[3186],{"type":398,"value":3162},{"type":393,"tag":601,"props":3188,"children":3189},{"style":613},[3190],{"type":398,"value":1432},{"type":393,"tag":601,"props":3192,"children":3193},{"class":603,"line":72},[3194,3199,3203,3207,3211,3215,3219,3223,3227,3231,3235,3239],{"type":393,"tag":601,"props":3195,"children":3196},{"style":667},[3197],{"type":398,"value":3198},"    'would_recommend'",{"type":393,"tag":601,"props":3200,"children":3201},{"style":613},[3202],{"type":398,"value":675},{"type":393,"tag":601,"props":3204,"children":3205},{"style":667},[3206],{"type":398,"value":929},{"type":393,"tag":601,"props":3208,"children":3209},{"style":613},[3210],{"type":398,"value":685},{"type":393,"tag":601,"props":3212,"children":3213},{"style":667},[3214],{"type":398,"value":938},{"type":393,"tag":601,"props":3216,"children":3217},{"style":613},[3218],{"type":398,"value":685},{"type":393,"tag":601,"props":3220,"children":3221},{"style":667},[3222],{"type":398,"value":929},{"type":393,"tag":601,"props":3224,"children":3225},{"style":613},[3226],{"type":398,"value":685},{"type":393,"tag":601,"props":3228,"children":3229},{"style":667},[3230],{"type":398,"value":938},{"type":393,"tag":601,"props":3232,"children":3233},{"style":613},[3234],{"type":398,"value":685},{"type":393,"tag":601,"props":3236,"children":3237},{"style":667},[3238],{"type":398,"value":929},{"type":393,"tag":601,"props":3240,"children":3241},{"style":613},[3242],{"type":398,"value":1432},{"type":393,"tag":601,"props":3244,"children":3245},{"class":603,"line":83},[3246,3251,3255,3259,3263,3268,3272,3276,3280,3284,3288,3292],{"type":393,"tag":601,"props":3247,"children":3248},{"style":667},[3249],{"type":398,"value":3250},"    'completed_survey'",{"type":393,"tag":601,"props":3252,"children":3253},{"style":613},[3254],{"type":398,"value":675},{"type":393,"tag":601,"props":3256,"children":3257},{"style":667},[3258],{"type":398,"value":680},{"type":393,"tag":601,"props":3260,"children":3261},{"style":613},[3262],{"type":398,"value":685},{"type":393,"tag":601,"props":3264,"children":3265},{"style":667},[3266],{"type":398,"value":3267},"'0'",{"type":393,"tag":601,"props":3269,"children":3270},{"style":613},[3271],{"type":398,"value":685},{"type":393,"tag":601,"props":3273,"children":3274},{"style":667},[3275],{"type":398,"value":680},{"type":393,"tag":601,"props":3277,"children":3278},{"style":613},[3279],{"type":398,"value":685},{"type":393,"tag":601,"props":3281,"children":3282},{"style":667},[3283],{"type":398,"value":680},{"type":393,"tag":601,"props":3285,"children":3286},{"style":613},[3287],{"type":398,"value":685},{"type":393,"tag":601,"props":3289,"children":3290},{"style":667},[3291],{"type":398,"value":3267},{"type":393,"tag":601,"props":3293,"children":3294},{"style":613},[3295],{"type":398,"value":1432},{"type":393,"tag":601,"props":3297,"children":3298},{"class":603,"line":92},[3299,3304,3308,3313,3317,3322,3326,3331,3335,3340,3344,3348],{"type":393,"tag":601,"props":3300,"children":3301},{"style":667},[3302],{"type":398,"value":3303},"    'opted_in_emails'",{"type":393,"tag":601,"props":3305,"children":3306},{"style":613},[3307],{"type":398,"value":675},{"type":393,"tag":601,"props":3309,"children":3310},{"style":667},[3311],{"type":398,"value":3312},"'y'",{"type":393,"tag":601,"props":3314,"children":3315},{"style":613},[3316],{"type":398,"value":685},{"type":393,"tag":601,"props":3318,"children":3319},{"style":667},[3320],{"type":398,"value":3321},"'n'",{"type":393,"tag":601,"props":3323,"children":3324},{"style":613},[3325],{"type":398,"value":685},{"type":393,"tag":601,"props":3327,"children":3328},{"style":667},[3329],{"type":398,"value":3330},"'Y'",{"type":393,"tag":601,"props":3332,"children":3333},{"style":613},[3334],{"type":398,"value":685},{"type":393,"tag":601,"props":3336,"children":3337},{"style":667},[3338],{"type":398,"value":3339},"'N'",{"type":393,"tag":601,"props":3341,"children":3342},{"style":613},[3343],{"type":398,"value":685},{"type":393,"tag":601,"props":3345,"children":3346},{"style":667},[3347],{"type":398,"value":3312},{"type":393,"tag":601,"props":3349,"children":3350},{"style":613},[3351],{"type":398,"value":1573},{"type":393,"tag":601,"props":3353,"children":3354},{"class":603,"line":101},[3355],{"type":393,"tag":601,"props":3356,"children":3357},{"style":613},[3358],{"type":398,"value":1041},{"type":393,"tag":601,"props":3360,"children":3361},{"class":603,"line":110},[3362],{"type":393,"tag":601,"props":3363,"children":3364},{"emptyLinePlaceholder":12},[3365],{"type":398,"value":634},{"type":393,"tag":601,"props":3367,"children":3368},{"class":603,"line":121},[3369,3373,3377,3382],{"type":393,"tag":601,"props":3370,"children":3371},{"style":1054},[3372],{"type":398,"value":1057},{"type":393,"tag":601,"props":3374,"children":3375},{"style":613},[3376],{"type":398,"value":1062},{"type":393,"tag":601,"props":3378,"children":3379},{"style":667},[3380],{"type":398,"value":3381},"\"📊 Survey Data (Booleans as Text):\"",{"type":393,"tag":601,"props":3383,"children":3384},{"style":613},[3385],{"type":398,"value":1072},{"type":393,"tag":601,"props":3387,"children":3388},{"class":603,"line":130},[3389,3393],{"type":393,"tag":601,"props":3390,"children":3391},{"style":1054},[3392],{"type":398,"value":1057},{"type":393,"tag":601,"props":3394,"children":3395},{"style":613},[3396],{"type":398,"value":3397},"(survey)\n",{"type":393,"tag":601,"props":3399,"children":3400},{"class":603,"line":139},[3401,3405],{"type":393,"tag":601,"props":3402,"children":3403},{"style":1054},[3404],{"type":398,"value":1057},{"type":393,"tag":601,"props":3406,"children":3407},{"style":613},[3408],{"type":398,"value":1096},{"type":393,"tag":601,"props":3410,"children":3411},{"class":603,"line":148},[3412],{"type":393,"tag":601,"props":3413,"children":3414},{"emptyLinePlaceholder":12},[3415],{"type":398,"value":634},{"type":393,"tag":601,"props":3417,"children":3418},{"class":603,"line":159},[3419,3423,3427,3432],{"type":393,"tag":601,"props":3420,"children":3421},{"style":1054},[3422],{"type":398,"value":1057},{"type":393,"tag":601,"props":3424,"children":3425},{"style":613},[3426],{"type":398,"value":1062},{"type":393,"tag":601,"props":3428,"children":3429},{"style":667},[3430],{"type":398,"value":3431},"\"✅ Converting to Boolean:\"",{"type":393,"tag":601,"props":3433,"children":3434},{"style":613},[3435],{"type":398,"value":1072},{"type":393,"tag":601,"props":3437,"children":3438},{"class":603,"line":168},[3439,3443],{"type":393,"tag":601,"props":3440,"children":3441},{"style":1054},[3442],{"type":398,"value":1057},{"type":393,"tag":601,"props":3444,"children":3445},{"style":613},[3446],{"type":398,"value":1096},{"type":393,"tag":601,"props":3448,"children":3449},{"class":603,"line":177},[3450],{"type":393,"tag":601,"props":3451,"children":3452},{"emptyLinePlaceholder":12},[3453],{"type":398,"value":634},{"type":393,"tag":601,"props":3455,"children":3456},{"class":603,"line":186},[3457,3461,3465,3470],{"type":393,"tag":601,"props":3458,"children":3459},{"style":1054},[3460],{"type":398,"value":1057},{"type":393,"tag":601,"props":3462,"children":3463},{"style":613},[3464],{"type":398,"value":1062},{"type":393,"tag":601,"props":3466,"children":3467},{"style":667},[3468],{"type":398,"value":3469},"\"1️⃣ Yes/No to True/False:\"",{"type":393,"tag":601,"props":3471,"children":3472},{"style":613},[3473],{"type":398,"value":1072},{"type":393,"tag":601,"props":3475,"children":3476},{"class":603,"line":197},[3477,3482,3487,3491,3495,3500,3504,3509,3513,3518,3522,3526,3530,3534,3539],{"type":393,"tag":601,"props":3478,"children":3479},{"style":613},[3480],{"type":398,"value":3481},"survey[",{"type":393,"tag":601,"props":3483,"children":3484},{"style":667},[3485],{"type":398,"value":3486},"'satisfied'",{"type":393,"tag":601,"props":3488,"children":3489},{"style":613},[3490],{"type":398,"value":1759},{"type":393,"tag":601,"props":3492,"children":3493},{"style":607},[3494],{"type":398,"value":656},{"type":393,"tag":601,"props":3496,"children":3497},{"style":613},[3498],{"type":398,"value":3499}," survey[",{"type":393,"tag":601,"props":3501,"children":3502},{"style":667},[3503],{"type":398,"value":3486},{"type":393,"tag":601,"props":3505,"children":3506},{"style":613},[3507],{"type":398,"value":3508},"].map({",{"type":393,"tag":601,"props":3510,"children":3511},{"style":667},[3512],{"type":398,"value":3153},{"type":393,"tag":601,"props":3514,"children":3515},{"style":613},[3516],{"type":398,"value":3517},": ",{"type":393,"tag":601,"props":3519,"children":3520},{"style":1054},[3521],{"type":398,"value":485},{"type":393,"tag":601,"props":3523,"children":3524},{"style":613},[3525],{"type":398,"value":685},{"type":393,"tag":601,"props":3527,"children":3528},{"style":667},[3529],{"type":398,"value":3162},{"type":393,"tag":601,"props":3531,"children":3532},{"style":613},[3533],{"type":398,"value":3517},{"type":393,"tag":601,"props":3535,"children":3536},{"style":1054},[3537],{"type":398,"value":3538},"False",{"type":393,"tag":601,"props":3540,"children":3541},{"style":613},[3542],{"type":398,"value":1041},{"type":393,"tag":601,"props":3544,"children":3545},{"class":603,"line":206},[3546,3550,3554,3559],{"type":393,"tag":601,"props":3547,"children":3548},{"style":1054},[3549],{"type":398,"value":1057},{"type":393,"tag":601,"props":3551,"children":3552},{"style":613},[3553],{"type":398,"value":1062},{"type":393,"tag":601,"props":3555,"children":3556},{"style":667},[3557],{"type":398,"value":3558},"\"Satisfied column:\"",{"type":393,"tag":601,"props":3560,"children":3561},{"style":613},[3562],{"type":398,"value":1072},{"type":393,"tag":601,"props":3564,"children":3565},{"class":603,"line":215},[3566,3570,3575,3579],{"type":393,"tag":601,"props":3567,"children":3568},{"style":1054},[3569],{"type":398,"value":1057},{"type":393,"tag":601,"props":3571,"children":3572},{"style":613},[3573],{"type":398,"value":3574},"(survey[",{"type":393,"tag":601,"props":3576,"children":3577},{"style":667},[3578],{"type":398,"value":3486},{"type":393,"tag":601,"props":3580,"children":3581},{"style":613},[3582],{"type":398,"value":2016},{"type":393,"tag":601,"props":3584,"children":3585},{"class":603,"line":224},[3586,3590],{"type":393,"tag":601,"props":3587,"children":3588},{"style":1054},[3589],{"type":398,"value":1057},{"type":393,"tag":601,"props":3591,"children":3592},{"style":613},[3593],{"type":398,"value":1096},{"type":393,"tag":601,"props":3595,"children":3596},{"class":603,"line":233},[3597],{"type":393,"tag":601,"props":3598,"children":3599},{"emptyLinePlaceholder":12},[3600],{"type":398,"value":634},{"type":393,"tag":601,"props":3602,"children":3603},{"class":603,"line":244},[3604,3608,3612,3617],{"type":393,"tag":601,"props":3605,"children":3606},{"style":1054},[3607],{"type":398,"value":1057},{"type":393,"tag":601,"props":3609,"children":3610},{"style":613},[3611],{"type":398,"value":1062},{"type":393,"tag":601,"props":3613,"children":3614},{"style":667},[3615],{"type":398,"value":3616},"\"2️⃣ True/False strings to boolean:\"",{"type":393,"tag":601,"props":3618,"children":3619},{"style":613},[3620],{"type":398,"value":1072},{"type":393,"tag":601,"props":3622,"children":3623},{"class":603,"line":253},[3624,3628,3633,3637,3641,3645,3649,3653,3658],{"type":393,"tag":601,"props":3625,"children":3626},{"style":613},[3627],{"type":398,"value":3481},{"type":393,"tag":601,"props":3629,"children":3630},{"style":667},[3631],{"type":398,"value":3632},"'would_recommend'",{"type":393,"tag":601,"props":3634,"children":3635},{"style":613},[3636],{"type":398,"value":1759},{"type":393,"tag":601,"props":3638,"children":3639},{"style":607},[3640],{"type":398,"value":656},{"type":393,"tag":601,"props":3642,"children":3643},{"style":613},[3644],{"type":398,"value":3499},{"type":393,"tag":601,"props":3646,"children":3647},{"style":667},[3648],{"type":398,"value":3632},{"type":393,"tag":601,"props":3650,"children":3651},{"style":613},[3652],{"type":398,"value":1759},{"type":393,"tag":601,"props":3654,"children":3655},{"style":607},[3656],{"type":398,"value":3657},"==",{"type":393,"tag":601,"props":3659,"children":3660},{"style":667},[3661],{"type":398,"value":3662}," 'True'\n",{"type":393,"tag":601,"props":3664,"children":3665},{"class":603,"line":262},[3666,3670,3674,3679],{"type":393,"tag":601,"props":3667,"children":3668},{"style":1054},[3669],{"type":398,"value":1057},{"type":393,"tag":601,"props":3671,"children":3672},{"style":613},[3673],{"type":398,"value":1062},{"type":393,"tag":601,"props":3675,"children":3676},{"style":667},[3677],{"type":398,"value":3678},"\"Would recommend column:\"",{"type":393,"tag":601,"props":3680,"children":3681},{"style":613},[3682],{"type":398,"value":1072},{"type":393,"tag":601,"props":3684,"children":3685},{"class":603,"line":271},[3686,3690,3694,3698],{"type":393,"tag":601,"props":3687,"children":3688},{"style":1054},[3689],{"type":398,"value":1057},{"type":393,"tag":601,"props":3691,"children":3692},{"style":613},[3693],{"type":398,"value":3574},{"type":393,"tag":601,"props":3695,"children":3696},{"style":667},[3697],{"type":398,"value":3632},{"type":393,"tag":601,"props":3699,"children":3700},{"style":613},[3701],{"type":398,"value":2016},{"type":393,"tag":601,"props":3703,"children":3704},{"class":603,"line":281},[3705,3709],{"type":393,"tag":601,"props":3706,"children":3707},{"style":1054},[3708],{"type":398,"value":1057},{"type":393,"tag":601,"props":3710,"children":3711},{"style":613},[3712],{"type":398,"value":1096},{"type":393,"tag":601,"props":3714,"children":3715},{"class":603,"line":290},[3716],{"type":393,"tag":601,"props":3717,"children":3718},{"emptyLinePlaceholder":12},[3719],{"type":398,"value":634},{"type":393,"tag":601,"props":3721,"children":3722},{"class":603,"line":299},[3723,3727,3731,3736],{"type":393,"tag":601,"props":3724,"children":3725},{"style":1054},[3726],{"type":398,"value":1057},{"type":393,"tag":601,"props":3728,"children":3729},{"style":613},[3730],{"type":398,"value":1062},{"type":393,"tag":601,"props":3732,"children":3733},{"style":667},[3734],{"type":398,"value":3735},"\"3️⃣ 1/0 to True/False:\"",{"type":393,"tag":601,"props":3737,"children":3738},{"style":613},[3739],{"type":398,"value":1072},{"type":393,"tag":601,"props":3741,"children":3742},{"class":603,"line":308},[3743,3747,3752,3756,3760,3764,3768,3772,3777],{"type":393,"tag":601,"props":3744,"children":3745},{"style":613},[3746],{"type":398,"value":3481},{"type":393,"tag":601,"props":3748,"children":3749},{"style":667},[3750],{"type":398,"value":3751},"'completed_survey'",{"type":393,"tag":601,"props":3753,"children":3754},{"style":613},[3755],{"type":398,"value":1759},{"type":393,"tag":601,"props":3757,"children":3758},{"style":607},[3759],{"type":398,"value":656},{"type":393,"tag":601,"props":3761,"children":3762},{"style":613},[3763],{"type":398,"value":3499},{"type":393,"tag":601,"props":3765,"children":3766},{"style":667},[3767],{"type":398,"value":3751},{"type":393,"tag":601,"props":3769,"children":3770},{"style":613},[3771],{"type":398,"value":1777},{"type":393,"tag":601,"props":3773,"children":3774},{"style":667},[3775],{"type":398,"value":3776},"'bool'",{"type":393,"tag":601,"props":3778,"children":3779},{"style":613},[3780],{"type":398,"value":1072},{"type":393,"tag":601,"props":3782,"children":3783},{"class":603,"line":318},[3784,3788,3792,3797],{"type":393,"tag":601,"props":3785,"children":3786},{"style":1054},[3787],{"type":398,"value":1057},{"type":393,"tag":601,"props":3789,"children":3790},{"style":613},[3791],{"type":398,"value":1062},{"type":393,"tag":601,"props":3793,"children":3794},{"style":667},[3795],{"type":398,"value":3796},"\"Completed survey column:\"",{"type":393,"tag":601,"props":3798,"children":3799},{"style":613},[3800],{"type":398,"value":1072},{"type":393,"tag":601,"props":3802,"children":3803},{"class":603,"line":327},[3804,3808,3812,3816],{"type":393,"tag":601,"props":3805,"children":3806},{"style":1054},[3807],{"type":398,"value":1057},{"type":393,"tag":601,"props":3809,"children":3810},{"style":613},[3811],{"type":398,"value":3574},{"type":393,"tag":601,"props":3813,"children":3814},{"style":667},[3815],{"type":398,"value":3751},{"type":393,"tag":601,"props":3817,"children":3818},{"style":613},[3819],{"type":398,"value":2016},{"type":393,"tag":601,"props":3821,"children":3822},{"class":603,"line":336},[3823,3827],{"type":393,"tag":601,"props":3824,"children":3825},{"style":1054},[3826],{"type":398,"value":1057},{"type":393,"tag":601,"props":3828,"children":3829},{"style":613},[3830],{"type":398,"value":1096},{"type":393,"tag":601,"props":3832,"children":3833},{"class":603,"line":346},[3834],{"type":393,"tag":601,"props":3835,"children":3836},{"emptyLinePlaceholder":12},[3837],{"type":398,"value":634},{"type":393,"tag":601,"props":3839,"children":3840},{"class":603,"line":355},[3841,3845,3849,3854],{"type":393,"tag":601,"props":3842,"children":3843},{"style":1054},[3844],{"type":398,"value":1057},{"type":393,"tag":601,"props":3846,"children":3847},{"style":613},[3848],{"type":398,"value":1062},{"type":393,"tag":601,"props":3850,"children":3851},{"style":667},[3852],{"type":398,"value":3853},"\"4️⃣ y/n variations to boolean:\"",{"type":393,"tag":601,"props":3855,"children":3856},{"style":613},[3857],{"type":398,"value":1072},{"type":393,"tag":601,"props":3859,"children":3860},{"class":603,"line":364},[3861,3865,3870,3874,3878,3882,3886,3891,3895,3899,3904],{"type":393,"tag":601,"props":3862,"children":3863},{"style":613},[3864],{"type":398,"value":3481},{"type":393,"tag":601,"props":3866,"children":3867},{"style":667},[3868],{"type":398,"value":3869},"'opted_in_emails'",{"type":393,"tag":601,"props":3871,"children":3872},{"style":613},[3873],{"type":398,"value":1759},{"type":393,"tag":601,"props":3875,"children":3876},{"style":607},[3877],{"type":398,"value":656},{"type":393,"tag":601,"props":3879,"children":3880},{"style":613},[3881],{"type":398,"value":3499},{"type":393,"tag":601,"props":3883,"children":3884},{"style":667},[3885],{"type":398,"value":3869},{"type":393,"tag":601,"props":3887,"children":3888},{"style":613},[3889],{"type":398,"value":3890},"].str.lower().isin([",{"type":393,"tag":601,"props":3892,"children":3893},{"style":667},[3894],{"type":398,"value":3312},{"type":393,"tag":601,"props":3896,"children":3897},{"style":613},[3898],{"type":398,"value":685},{"type":393,"tag":601,"props":3900,"children":3901},{"style":667},[3902],{"type":398,"value":3903},"'yes'",{"type":393,"tag":601,"props":3905,"children":3906},{"style":613},[3907],{"type":398,"value":2016},{"type":393,"tag":601,"props":3909,"children":3910},{"class":603,"line":374},[3911,3915,3919,3924],{"type":393,"tag":601,"props":3912,"children":3913},{"style":1054},[3914],{"type":398,"value":1057},{"type":393,"tag":601,"props":3916,"children":3917},{"style":613},[3918],{"type":398,"value":1062},{"type":393,"tag":601,"props":3920,"children":3921},{"style":667},[3922],{"type":398,"value":3923},"\"Opted in emails column:\"",{"type":393,"tag":601,"props":3925,"children":3926},{"style":613},[3927],{"type":398,"value":1072},{"type":393,"tag":601,"props":3929,"children":3930},{"class":603,"line":383},[3931,3935,3939,3943],{"type":393,"tag":601,"props":3932,"children":3933},{"style":1054},[3934],{"type":398,"value":1057},{"type":393,"tag":601,"props":3936,"children":3937},{"style":613},[3938],{"type":398,"value":3574},{"type":393,"tag":601,"props":3940,"children":3941},{"style":667},[3942],{"type":398,"value":3869},{"type":393,"tag":601,"props":3944,"children":3945},{"style":613},[3946],{"type":398,"value":2016},{"type":393,"tag":601,"props":3948,"children":3950},{"class":603,"line":3949},41,[3951,3955],{"type":393,"tag":601,"props":3952,"children":3953},{"style":1054},[3954],{"type":398,"value":1057},{"type":393,"tag":601,"props":3956,"children":3957},{"style":613},[3958],{"type":398,"value":1096},{"type":393,"tag":601,"props":3960,"children":3962},{"class":603,"line":3961},42,[3963],{"type":393,"tag":601,"props":3964,"children":3965},{"emptyLinePlaceholder":12},[3966],{"type":398,"value":634},{"type":393,"tag":601,"props":3968,"children":3970},{"class":603,"line":3969},43,[3971,3975,3979,3984],{"type":393,"tag":601,"props":3972,"children":3973},{"style":1054},[3974],{"type":398,"value":1057},{"type":393,"tag":601,"props":3976,"children":3977},{"style":613},[3978],{"type":398,"value":1062},{"type":393,"tag":601,"props":3980,"children":3981},{"style":667},[3982],{"type":398,"value":3983},"\"Final data with proper boolean types:\"",{"type":393,"tag":601,"props":3985,"children":3986},{"style":613},[3987],{"type":398,"value":1072},{"type":393,"tag":601,"props":3989,"children":3991},{"class":603,"line":3990},44,[3992,3996],{"type":393,"tag":601,"props":3993,"children":3994},{"style":1054},[3995],{"type":398,"value":1057},{"type":393,"tag":601,"props":3997,"children":3998},{"style":613},[3999],{"type":398,"value":4000},"(survey.dtypes)\n",{"type":393,"tag":575,"props":4002,"children":4004},{"id":4003},"️-converting-to-categories",[4005],{"type":398,"value":4006},"🏷️ Converting to Categories",{"type":393,"tag":401,"props":4008,"children":4009},{},[4010],{"type":398,"value":4011},"Convert repetitive text to efficient categorical data:",{"type":393,"tag":587,"props":4013,"children":4014},{},[4015],{"type":393,"tag":591,"props":4016,"children":4018},{"className":593,"code":4017,"language":595,"meta":6,"style":6},"import pandas as pd\n\n# Customer data with repetitive categories\ncustomers = pd.DataFrame({\n    'customer_id': [1, 2, 3, 4, 5, 6],\n    'membership_level': ['Bronze', 'Silver', 'Gold', 'Bronze', 'Silver', 'Bronze'],\n    'region': ['North', 'South', 'East', 'North', 'West', 'South'],\n    'preferred_contact': ['Email', 'Phone', 'Email', 'SMS', 'Email', 'Phone']\n})\n\nprint(\"📊 Customer Data with Repetitive Categories:\")\nprint(customers)\nprint()\n\nprint(\"Memory usage before conversion:\")\nprint(customers.memory_usage(deep=True))\nprint()\n\nprint(\"🏷️ Converting to Categories:\")\nprint()\n\nprint(\"1️⃣ Convert membership_level to category:\")\ncustomers['membership_level'] = customers['membership_level'].astype('category')\nprint(\"Membership levels:\")\nprint(customers['membership_level'])\nprint(\"Categories:\", customers['membership_level'].cat.categories.tolist())\nprint()\n\nprint(\"2️⃣ Convert all text columns to categories:\")\ntext_columns = ['region', 'preferred_contact']\nfor col in text_columns:\n    customers[col] = customers[col].astype('category')\n\nprint(\"Data types after conversion:\")\nprint(customers.dtypes)\nprint()\n\nprint(\"Memory usage after conversion:\")\nprint(customers.memory_usage(deep=True))\nprint()\n\nprint(\"💡 Benefits of categories:\")\nprint(\"- Less memory usage\")\nprint(\"- Faster operations\")\nprint(\"- Ordered categories possible\")\nprint(\"- Prevents typos in analysis\")\n",[4019],{"type":393,"tag":441,"props":4020,"children":4021},{"__ignoreMap":6},[4022,4041,4048,4056,4072,4132,4195,4259,4322,4329,4336,4356,4368,4379,4386,4406,4437,4448,4455,4475,4486,4493,4513,4556,4576,4596,4626,4637,4644,4664,4698,4718,4743,4750,4770,4782,4793,4800,4820,4847,4858,4865,4885,4905,4925,4946],{"type":393,"tag":601,"props":4023,"children":4024},{"class":603,"line":11},[4025,4029,4033,4037],{"type":393,"tag":601,"props":4026,"children":4027},{"style":607},[4028],{"type":398,"value":610},{"type":393,"tag":601,"props":4030,"children":4031},{"style":613},[4032],{"type":398,"value":616},{"type":393,"tag":601,"props":4034,"children":4035},{"style":607},[4036],{"type":398,"value":621},{"type":393,"tag":601,"props":4038,"children":4039},{"style":613},[4040],{"type":398,"value":626},{"type":393,"tag":601,"props":4042,"children":4043},{"class":603,"line":27},[4044],{"type":393,"tag":601,"props":4045,"children":4046},{"emptyLinePlaceholder":12},[4047],{"type":398,"value":634},{"type":393,"tag":601,"props":4049,"children":4050},{"class":603,"line":36},[4051],{"type":393,"tag":601,"props":4052,"children":4053},{"style":640},[4054],{"type":398,"value":4055},"# Customer data with repetitive categories\n",{"type":393,"tag":601,"props":4057,"children":4058},{"class":603,"line":45},[4059,4064,4068],{"type":393,"tag":601,"props":4060,"children":4061},{"style":613},[4062],{"type":398,"value":4063},"customers ",{"type":393,"tag":601,"props":4065,"children":4066},{"style":607},[4067],{"type":398,"value":656},{"type":393,"tag":601,"props":4069,"children":4070},{"style":613},[4071],{"type":398,"value":661},{"type":393,"tag":601,"props":4073,"children":4074},{"class":603,"line":54},[4075,4079,4083,4087,4091,4095,4099,4103,4107,4111,4115,4119,4123,4128],{"type":393,"tag":601,"props":4076,"children":4077},{"style":667},[4078],{"type":398,"value":670},{"type":393,"tag":601,"props":4080,"children":4081},{"style":613},[4082],{"type":398,"value":675},{"type":393,"tag":601,"props":4084,"children":4085},{"style":1054},[4086],{"type":398,"value":2198},{"type":393,"tag":601,"props":4088,"children":4089},{"style":613},[4090],{"type":398,"value":685},{"type":393,"tag":601,"props":4092,"children":4093},{"style":1054},[4094],{"type":398,"value":2207},{"type":393,"tag":601,"props":4096,"children":4097},{"style":613},[4098],{"type":398,"value":685},{"type":393,"tag":601,"props":4100,"children":4101},{"style":1054},[4102],{"type":398,"value":2216},{"type":393,"tag":601,"props":4104,"children":4105},{"style":613},[4106],{"type":398,"value":685},{"type":393,"tag":601,"props":4108,"children":4109},{"style":1054},[4110],{"type":398,"value":2225},{"type":393,"tag":601,"props":4112,"children":4113},{"style":613},[4114],{"type":398,"value":685},{"type":393,"tag":601,"props":4116,"children":4117},{"style":1054},[4118],{"type":398,"value":3132},{"type":393,"tag":601,"props":4120,"children":4121},{"style":613},[4122],{"type":398,"value":685},{"type":393,"tag":601,"props":4124,"children":4125},{"style":1054},[4126],{"type":398,"value":4127},"6",{"type":393,"tag":601,"props":4129,"children":4130},{"style":613},[4131],{"type":398,"value":1432},{"type":393,"tag":601,"props":4133,"children":4134},{"class":603,"line":63},[4135,4140,4144,4149,4153,4158,4162,4167,4171,4175,4179,4183,4187,4191],{"type":393,"tag":601,"props":4136,"children":4137},{"style":667},[4138],{"type":398,"value":4139},"    'membership_level'",{"type":393,"tag":601,"props":4141,"children":4142},{"style":613},[4143],{"type":398,"value":675},{"type":393,"tag":601,"props":4145,"children":4146},{"style":667},[4147],{"type":398,"value":4148},"'Bronze'",{"type":393,"tag":601,"props":4150,"children":4151},{"style":613},[4152],{"type":398,"value":685},{"type":393,"tag":601,"props":4154,"children":4155},{"style":667},[4156],{"type":398,"value":4157},"'Silver'",{"type":393,"tag":601,"props":4159,"children":4160},{"style":613},[4161],{"type":398,"value":685},{"type":393,"tag":601,"props":4163,"children":4164},{"style":667},[4165],{"type":398,"value":4166},"'Gold'",{"type":393,"tag":601,"props":4168,"children":4169},{"style":613},[4170],{"type":398,"value":685},{"type":393,"tag":601,"props":4172,"children":4173},{"style":667},[4174],{"type":398,"value":4148},{"type":393,"tag":601,"props":4176,"children":4177},{"style":613},[4178],{"type":398,"value":685},{"type":393,"tag":601,"props":4180,"children":4181},{"style":667},[4182],{"type":398,"value":4157},{"type":393,"tag":601,"props":4184,"children":4185},{"style":613},[4186],{"type":398,"value":685},{"type":393,"tag":601,"props":4188,"children":4189},{"style":667},[4190],{"type":398,"value":4148},{"type":393,"tag":601,"props":4192,"children":4193},{"style":613},[4194],{"type":398,"value":1432},{"type":393,"tag":601,"props":4196,"children":4197},{"class":603,"line":72},[4198,4203,4207,4212,4216,4221,4225,4230,4234,4238,4242,4247,4251,4255],{"type":393,"tag":601,"props":4199,"children":4200},{"style":667},[4201],{"type":398,"value":4202},"    'region'",{"type":393,"tag":601,"props":4204,"children":4205},{"style":613},[4206],{"type":398,"value":675},{"type":393,"tag":601,"props":4208,"children":4209},{"style":667},[4210],{"type":398,"value":4211},"'North'",{"type":393,"tag":601,"props":4213,"children":4214},{"style":613},[4215],{"type":398,"value":685},{"type":393,"tag":601,"props":4217,"children":4218},{"style":667},[4219],{"type":398,"value":4220},"'South'",{"type":393,"tag":601,"props":4222,"children":4223},{"style":613},[4224],{"type":398,"value":685},{"type":393,"tag":601,"props":4226,"children":4227},{"style":667},[4228],{"type":398,"value":4229},"'East'",{"type":393,"tag":601,"props":4231,"children":4232},{"style":613},[4233],{"type":398,"value":685},{"type":393,"tag":601,"props":4235,"children":4236},{"style":667},[4237],{"type":398,"value":4211},{"type":393,"tag":601,"props":4239,"children":4240},{"style":613},[4241],{"type":398,"value":685},{"type":393,"tag":601,"props":4243,"children":4244},{"style":667},[4245],{"type":398,"value":4246},"'West'",{"type":393,"tag":601,"props":4248,"children":4249},{"style":613},[4250],{"type":398,"value":685},{"type":393,"tag":601,"props":4252,"children":4253},{"style":667},[4254],{"type":398,"value":4220},{"type":393,"tag":601,"props":4256,"children":4257},{"style":613},[4258],{"type":398,"value":1432},{"type":393,"tag":601,"props":4260,"children":4261},{"class":603,"line":83},[4262,4267,4271,4276,4280,4285,4289,4293,4297,4302,4306,4310,4314,4318],{"type":393,"tag":601,"props":4263,"children":4264},{"style":667},[4265],{"type":398,"value":4266},"    'preferred_contact'",{"type":393,"tag":601,"props":4268,"children":4269},{"style":613},[4270],{"type":398,"value":675},{"type":393,"tag":601,"props":4272,"children":4273},{"style":667},[4274],{"type":398,"value":4275},"'Email'",{"type":393,"tag":601,"props":4277,"children":4278},{"style":613},[4279],{"type":398,"value":685},{"type":393,"tag":601,"props":4281,"children":4282},{"style":667},[4283],{"type":398,"value":4284},"'Phone'",{"type":393,"tag":601,"props":4286,"children":4287},{"style":613},[4288],{"type":398,"value":685},{"type":393,"tag":601,"props":4290,"children":4291},{"style":667},[4292],{"type":398,"value":4275},{"type":393,"tag":601,"props":4294,"children":4295},{"style":613},[4296],{"type":398,"value":685},{"type":393,"tag":601,"props":4298,"children":4299},{"style":667},[4300],{"type":398,"value":4301},"'SMS'",{"type":393,"tag":601,"props":4303,"children":4304},{"style":613},[4305],{"type":398,"value":685},{"type":393,"tag":601,"props":4307,"children":4308},{"style":667},[4309],{"type":398,"value":4275},{"type":393,"tag":601,"props":4311,"children":4312},{"style":613},[4313],{"type":398,"value":685},{"type":393,"tag":601,"props":4315,"children":4316},{"style":667},[4317],{"type":398,"value":4284},{"type":393,"tag":601,"props":4319,"children":4320},{"style":613},[4321],{"type":398,"value":1573},{"type":393,"tag":601,"props":4323,"children":4324},{"class":603,"line":92},[4325],{"type":393,"tag":601,"props":4326,"children":4327},{"style":613},[4328],{"type":398,"value":1041},{"type":393,"tag":601,"props":4330,"children":4331},{"class":603,"line":101},[4332],{"type":393,"tag":601,"props":4333,"children":4334},{"emptyLinePlaceholder":12},[4335],{"type":398,"value":634},{"type":393,"tag":601,"props":4337,"children":4338},{"class":603,"line":110},[4339,4343,4347,4352],{"type":393,"tag":601,"props":4340,"children":4341},{"style":1054},[4342],{"type":398,"value":1057},{"type":393,"tag":601,"props":4344,"children":4345},{"style":613},[4346],{"type":398,"value":1062},{"type":393,"tag":601,"props":4348,"children":4349},{"style":667},[4350],{"type":398,"value":4351},"\"📊 Customer Data with Repetitive Categories:\"",{"type":393,"tag":601,"props":4353,"children":4354},{"style":613},[4355],{"type":398,"value":1072},{"type":393,"tag":601,"props":4357,"children":4358},{"class":603,"line":121},[4359,4363],{"type":393,"tag":601,"props":4360,"children":4361},{"style":1054},[4362],{"type":398,"value":1057},{"type":393,"tag":601,"props":4364,"children":4365},{"style":613},[4366],{"type":398,"value":4367},"(customers)\n",{"type":393,"tag":601,"props":4369,"children":4370},{"class":603,"line":130},[4371,4375],{"type":393,"tag":601,"props":4372,"children":4373},{"style":1054},[4374],{"type":398,"value":1057},{"type":393,"tag":601,"props":4376,"children":4377},{"style":613},[4378],{"type":398,"value":1096},{"type":393,"tag":601,"props":4380,"children":4381},{"class":603,"line":139},[4382],{"type":393,"tag":601,"props":4383,"children":4384},{"emptyLinePlaceholder":12},[4385],{"type":398,"value":634},{"type":393,"tag":601,"props":4387,"children":4388},{"class":603,"line":148},[4389,4393,4397,4402],{"type":393,"tag":601,"props":4390,"children":4391},{"style":1054},[4392],{"type":398,"value":1057},{"type":393,"tag":601,"props":4394,"children":4395},{"style":613},[4396],{"type":398,"value":1062},{"type":393,"tag":601,"props":4398,"children":4399},{"style":667},[4400],{"type":398,"value":4401},"\"Memory usage before conversion:\"",{"type":393,"tag":601,"props":4403,"children":4404},{"style":613},[4405],{"type":398,"value":1072},{"type":393,"tag":601,"props":4407,"children":4408},{"class":603,"line":159},[4409,4413,4418,4424,4428,4432],{"type":393,"tag":601,"props":4410,"children":4411},{"style":1054},[4412],{"type":398,"value":1057},{"type":393,"tag":601,"props":4414,"children":4415},{"style":613},[4416],{"type":398,"value":4417},"(customers.memory_usage(",{"type":393,"tag":601,"props":4419,"children":4421},{"style":4420},"--shiki-default:#E36209;--shiki-app-dark-mode:#FFAB70",[4422],{"type":398,"value":4423},"deep",{"type":393,"tag":601,"props":4425,"children":4426},{"style":607},[4427],{"type":398,"value":656},{"type":393,"tag":601,"props":4429,"children":4430},{"style":1054},[4431],{"type":398,"value":485},{"type":393,"tag":601,"props":4433,"children":4434},{"style":613},[4435],{"type":398,"value":4436},"))\n",{"type":393,"tag":601,"props":4438,"children":4439},{"class":603,"line":168},[4440,4444],{"type":393,"tag":601,"props":4441,"children":4442},{"style":1054},[4443],{"type":398,"value":1057},{"type":393,"tag":601,"props":4445,"children":4446},{"style":613},[4447],{"type":398,"value":1096},{"type":393,"tag":601,"props":4449,"children":4450},{"class":603,"line":177},[4451],{"type":393,"tag":601,"props":4452,"children":4453},{"emptyLinePlaceholder":12},[4454],{"type":398,"value":634},{"type":393,"tag":601,"props":4456,"children":4457},{"class":603,"line":186},[4458,4462,4466,4471],{"type":393,"tag":601,"props":4459,"children":4460},{"style":1054},[4461],{"type":398,"value":1057},{"type":393,"tag":601,"props":4463,"children":4464},{"style":613},[4465],{"type":398,"value":1062},{"type":393,"tag":601,"props":4467,"children":4468},{"style":667},[4469],{"type":398,"value":4470},"\"🏷️ Converting to Categories:\"",{"type":393,"tag":601,"props":4472,"children":4473},{"style":613},[4474],{"type":398,"value":1072},{"type":393,"tag":601,"props":4476,"children":4477},{"class":603,"line":197},[4478,4482],{"type":393,"tag":601,"props":4479,"children":4480},{"style":1054},[4481],{"type":398,"value":1057},{"type":393,"tag":601,"props":4483,"children":4484},{"style":613},[4485],{"type":398,"value":1096},{"type":393,"tag":601,"props":4487,"children":4488},{"class":603,"line":206},[4489],{"type":393,"tag":601,"props":4490,"children":4491},{"emptyLinePlaceholder":12},[4492],{"type":398,"value":634},{"type":393,"tag":601,"props":4494,"children":4495},{"class":603,"line":215},[4496,4500,4504,4509],{"type":393,"tag":601,"props":4497,"children":4498},{"style":1054},[4499],{"type":398,"value":1057},{"type":393,"tag":601,"props":4501,"children":4502},{"style":613},[4503],{"type":398,"value":1062},{"type":393,"tag":601,"props":4505,"children":4506},{"style":667},[4507],{"type":398,"value":4508},"\"1️⃣ Convert membership_level to category:\"",{"type":393,"tag":601,"props":4510,"children":4511},{"style":613},[4512],{"type":398,"value":1072},{"type":393,"tag":601,"props":4514,"children":4515},{"class":603,"line":224},[4516,4521,4526,4530,4534,4539,4543,4547,4552],{"type":393,"tag":601,"props":4517,"children":4518},{"style":613},[4519],{"type":398,"value":4520},"customers[",{"type":393,"tag":601,"props":4522,"children":4523},{"style":667},[4524],{"type":398,"value":4525},"'membership_level'",{"type":393,"tag":601,"props":4527,"children":4528},{"style":613},[4529],{"type":398,"value":1759},{"type":393,"tag":601,"props":4531,"children":4532},{"style":607},[4533],{"type":398,"value":656},{"type":393,"tag":601,"props":4535,"children":4536},{"style":613},[4537],{"type":398,"value":4538}," customers[",{"type":393,"tag":601,"props":4540,"children":4541},{"style":667},[4542],{"type":398,"value":4525},{"type":393,"tag":601,"props":4544,"children":4545},{"style":613},[4546],{"type":398,"value":1777},{"type":393,"tag":601,"props":4548,"children":4549},{"style":667},[4550],{"type":398,"value":4551},"'category'",{"type":393,"tag":601,"props":4553,"children":4554},{"style":613},[4555],{"type":398,"value":1072},{"type":393,"tag":601,"props":4557,"children":4558},{"class":603,"line":233},[4559,4563,4567,4572],{"type":393,"tag":601,"props":4560,"children":4561},{"style":1054},[4562],{"type":398,"value":1057},{"type":393,"tag":601,"props":4564,"children":4565},{"style":613},[4566],{"type":398,"value":1062},{"type":393,"tag":601,"props":4568,"children":4569},{"style":667},[4570],{"type":398,"value":4571},"\"Membership levels:\"",{"type":393,"tag":601,"props":4573,"children":4574},{"style":613},[4575],{"type":398,"value":1072},{"type":393,"tag":601,"props":4577,"children":4578},{"class":603,"line":244},[4579,4583,4588,4592],{"type":393,"tag":601,"props":4580,"children":4581},{"style":1054},[4582],{"type":398,"value":1057},{"type":393,"tag":601,"props":4584,"children":4585},{"style":613},[4586],{"type":398,"value":4587},"(customers[",{"type":393,"tag":601,"props":4589,"children":4590},{"style":667},[4591],{"type":398,"value":4525},{"type":393,"tag":601,"props":4593,"children":4594},{"style":613},[4595],{"type":398,"value":2016},{"type":393,"tag":601,"props":4597,"children":4598},{"class":603,"line":253},[4599,4603,4607,4612,4617,4621],{"type":393,"tag":601,"props":4600,"children":4601},{"style":1054},[4602],{"type":398,"value":1057},{"type":393,"tag":601,"props":4604,"children":4605},{"style":613},[4606],{"type":398,"value":1062},{"type":393,"tag":601,"props":4608,"children":4609},{"style":667},[4610],{"type":398,"value":4611},"\"Categories:\"",{"type":393,"tag":601,"props":4613,"children":4614},{"style":613},[4615],{"type":398,"value":4616},", customers[",{"type":393,"tag":601,"props":4618,"children":4619},{"style":667},[4620],{"type":398,"value":4525},{"type":393,"tag":601,"props":4622,"children":4623},{"style":613},[4624],{"type":398,"value":4625},"].cat.categories.tolist())\n",{"type":393,"tag":601,"props":4627,"children":4628},{"class":603,"line":262},[4629,4633],{"type":393,"tag":601,"props":4630,"children":4631},{"style":1054},[4632],{"type":398,"value":1057},{"type":393,"tag":601,"props":4634,"children":4635},{"style":613},[4636],{"type":398,"value":1096},{"type":393,"tag":601,"props":4638,"children":4639},{"class":603,"line":271},[4640],{"type":393,"tag":601,"props":4641,"children":4642},{"emptyLinePlaceholder":12},[4643],{"type":398,"value":634},{"type":393,"tag":601,"props":4645,"children":4646},{"class":603,"line":281},[4647,4651,4655,4660],{"type":393,"tag":601,"props":4648,"children":4649},{"style":1054},[4650],{"type":398,"value":1057},{"type":393,"tag":601,"props":4652,"children":4653},{"style":613},[4654],{"type":398,"value":1062},{"type":393,"tag":601,"props":4656,"children":4657},{"style":667},[4658],{"type":398,"value":4659},"\"2️⃣ Convert all text columns to categories:\"",{"type":393,"tag":601,"props":4661,"children":4662},{"style":613},[4663],{"type":398,"value":1072},{"type":393,"tag":601,"props":4665,"children":4666},{"class":603,"line":290},[4667,4672,4676,4680,4685,4689,4694],{"type":393,"tag":601,"props":4668,"children":4669},{"style":613},[4670],{"type":398,"value":4671},"text_columns ",{"type":393,"tag":601,"props":4673,"children":4674},{"style":607},[4675],{"type":398,"value":656},{"type":393,"tag":601,"props":4677,"children":4678},{"style":613},[4679],{"type":398,"value":2717},{"type":393,"tag":601,"props":4681,"children":4682},{"style":667},[4683],{"type":398,"value":4684},"'region'",{"type":393,"tag":601,"props":4686,"children":4687},{"style":613},[4688],{"type":398,"value":685},{"type":393,"tag":601,"props":4690,"children":4691},{"style":667},[4692],{"type":398,"value":4693},"'preferred_contact'",{"type":393,"tag":601,"props":4695,"children":4696},{"style":613},[4697],{"type":398,"value":1573},{"type":393,"tag":601,"props":4699,"children":4700},{"class":603,"line":299},[4701,4705,4709,4713],{"type":393,"tag":601,"props":4702,"children":4703},{"style":607},[4704],{"type":398,"value":2742},{"type":393,"tag":601,"props":4706,"children":4707},{"style":613},[4708],{"type":398,"value":2747},{"type":393,"tag":601,"props":4710,"children":4711},{"style":607},[4712],{"type":398,"value":2752},{"type":393,"tag":601,"props":4714,"children":4715},{"style":613},[4716],{"type":398,"value":4717}," text_columns:\n",{"type":393,"tag":601,"props":4719,"children":4720},{"class":603,"line":308},[4721,4726,4730,4735,4739],{"type":393,"tag":601,"props":4722,"children":4723},{"style":613},[4724],{"type":398,"value":4725},"    customers[col] ",{"type":393,"tag":601,"props":4727,"children":4728},{"style":607},[4729],{"type":398,"value":656},{"type":393,"tag":601,"props":4731,"children":4732},{"style":613},[4733],{"type":398,"value":4734}," customers[col].astype(",{"type":393,"tag":601,"props":4736,"children":4737},{"style":667},[4738],{"type":398,"value":4551},{"type":393,"tag":601,"props":4740,"children":4741},{"style":613},[4742],{"type":398,"value":1072},{"type":393,"tag":601,"props":4744,"children":4745},{"class":603,"line":318},[4746],{"type":393,"tag":601,"props":4747,"children":4748},{"emptyLinePlaceholder":12},[4749],{"type":398,"value":634},{"type":393,"tag":601,"props":4751,"children":4752},{"class":603,"line":327},[4753,4757,4761,4766],{"type":393,"tag":601,"props":4754,"children":4755},{"style":1054},[4756],{"type":398,"value":1057},{"type":393,"tag":601,"props":4758,"children":4759},{"style":613},[4760],{"type":398,"value":1062},{"type":393,"tag":601,"props":4762,"children":4763},{"style":667},[4764],{"type":398,"value":4765},"\"Data types after conversion:\"",{"type":393,"tag":601,"props":4767,"children":4768},{"style":613},[4769],{"type":398,"value":1072},{"type":393,"tag":601,"props":4771,"children":4772},{"class":603,"line":336},[4773,4777],{"type":393,"tag":601,"props":4774,"children":4775},{"style":1054},[4776],{"type":398,"value":1057},{"type":393,"tag":601,"props":4778,"children":4779},{"style":613},[4780],{"type":398,"value":4781},"(customers.dtypes)\n",{"type":393,"tag":601,"props":4783,"children":4784},{"class":603,"line":346},[4785,4789],{"type":393,"tag":601,"props":4786,"children":4787},{"style":1054},[4788],{"type":398,"value":1057},{"type":393,"tag":601,"props":4790,"children":4791},{"style":613},[4792],{"type":398,"value":1096},{"type":393,"tag":601,"props":4794,"children":4795},{"class":603,"line":355},[4796],{"type":393,"tag":601,"props":4797,"children":4798},{"emptyLinePlaceholder":12},[4799],{"type":398,"value":634},{"type":393,"tag":601,"props":4801,"children":4802},{"class":603,"line":364},[4803,4807,4811,4816],{"type":393,"tag":601,"props":4804,"children":4805},{"style":1054},[4806],{"type":398,"value":1057},{"type":393,"tag":601,"props":4808,"children":4809},{"style":613},[4810],{"type":398,"value":1062},{"type":393,"tag":601,"props":4812,"children":4813},{"style":667},[4814],{"type":398,"value":4815},"\"Memory usage after conversion:\"",{"type":393,"tag":601,"props":4817,"children":4818},{"style":613},[4819],{"type":398,"value":1072},{"type":393,"tag":601,"props":4821,"children":4822},{"class":603,"line":374},[4823,4827,4831,4835,4839,4843],{"type":393,"tag":601,"props":4824,"children":4825},{"style":1054},[4826],{"type":398,"value":1057},{"type":393,"tag":601,"props":4828,"children":4829},{"style":613},[4830],{"type":398,"value":4417},{"type":393,"tag":601,"props":4832,"children":4833},{"style":4420},[4834],{"type":398,"value":4423},{"type":393,"tag":601,"props":4836,"children":4837},{"style":607},[4838],{"type":398,"value":656},{"type":393,"tag":601,"props":4840,"children":4841},{"style":1054},[4842],{"type":398,"value":485},{"type":393,"tag":601,"props":4844,"children":4845},{"style":613},[4846],{"type":398,"value":4436},{"type":393,"tag":601,"props":4848,"children":4849},{"class":603,"line":383},[4850,4854],{"type":393,"tag":601,"props":4851,"children":4852},{"style":1054},[4853],{"type":398,"value":1057},{"type":393,"tag":601,"props":4855,"children":4856},{"style":613},[4857],{"type":398,"value":1096},{"type":393,"tag":601,"props":4859,"children":4860},{"class":603,"line":3949},[4861],{"type":393,"tag":601,"props":4862,"children":4863},{"emptyLinePlaceholder":12},[4864],{"type":398,"value":634},{"type":393,"tag":601,"props":4866,"children":4867},{"class":603,"line":3961},[4868,4872,4876,4881],{"type":393,"tag":601,"props":4869,"children":4870},{"style":1054},[4871],{"type":398,"value":1057},{"type":393,"tag":601,"props":4873,"children":4874},{"style":613},[4875],{"type":398,"value":1062},{"type":393,"tag":601,"props":4877,"children":4878},{"style":667},[4879],{"type":398,"value":4880},"\"💡 Benefits of categories:\"",{"type":393,"tag":601,"props":4882,"children":4883},{"style":613},[4884],{"type":398,"value":1072},{"type":393,"tag":601,"props":4886,"children":4887},{"class":603,"line":3969},[4888,4892,4896,4901],{"type":393,"tag":601,"props":4889,"children":4890},{"style":1054},[4891],{"type":398,"value":1057},{"type":393,"tag":601,"props":4893,"children":4894},{"style":613},[4895],{"type":398,"value":1062},{"type":393,"tag":601,"props":4897,"children":4898},{"style":667},[4899],{"type":398,"value":4900},"\"- Less memory usage\"",{"type":393,"tag":601,"props":4902,"children":4903},{"style":613},[4904],{"type":398,"value":1072},{"type":393,"tag":601,"props":4906,"children":4907},{"class":603,"line":3990},[4908,4912,4916,4921],{"type":393,"tag":601,"props":4909,"children":4910},{"style":1054},[4911],{"type":398,"value":1057},{"type":393,"tag":601,"props":4913,"children":4914},{"style":613},[4915],{"type":398,"value":1062},{"type":393,"tag":601,"props":4917,"children":4918},{"style":667},[4919],{"type":398,"value":4920},"\"- Faster operations\"",{"type":393,"tag":601,"props":4922,"children":4923},{"style":613},[4924],{"type":398,"value":1072},{"type":393,"tag":601,"props":4926,"children":4928},{"class":603,"line":4927},45,[4929,4933,4937,4942],{"type":393,"tag":601,"props":4930,"children":4931},{"style":1054},[4932],{"type":398,"value":1057},{"type":393,"tag":601,"props":4934,"children":4935},{"style":613},[4936],{"type":398,"value":1062},{"type":393,"tag":601,"props":4938,"children":4939},{"style":667},[4940],{"type":398,"value":4941},"\"- Ordered categories possible\"",{"type":393,"tag":601,"props":4943,"children":4944},{"style":613},[4945],{"type":398,"value":1072},{"type":393,"tag":601,"props":4947,"children":4949},{"class":603,"line":4948},46,[4950,4954,4958,4963],{"type":393,"tag":601,"props":4951,"children":4952},{"style":1054},[4953],{"type":398,"value":1057},{"type":393,"tag":601,"props":4955,"children":4956},{"style":613},[4957],{"type":398,"value":1062},{"type":393,"tag":601,"props":4959,"children":4960},{"style":667},[4961],{"type":398,"value":4962},"\"- Prevents typos in analysis\"",{"type":393,"tag":601,"props":4964,"children":4965},{"style":613},[4966],{"type":398,"value":1072},{"type":393,"tag":575,"props":4968,"children":4970},{"id":4969},"️-handling-conversion-errors",[4971],{"type":398,"value":4972},"🛠️ Handling Conversion Errors",{"type":393,"tag":401,"props":4974,"children":4975},{},[4976],{"type":398,"value":4977},"Real data is messy - handle conversion errors gracefully:",{"type":393,"tag":587,"props":4979,"children":4980},{},[4981],{"type":393,"tag":591,"props":4982,"children":4984},{"className":593,"code":4983,"language":595,"meta":6,"style":6},"import pandas as pd\nimport numpy as np\n\n# Messy data with conversion challenges\nmessy_numbers = pd.DataFrame({\n    'id': ['1', '2', '3', '4', '5'],\n    'score': ['85', '92', 'N/A', '78', '88'],  # Contains N/A\n    'percentage': ['15%', '23%', '8%', 'missing', '45%'],  # Contains % and text\n    'amount': ['$100.50', '$75.25', 'free', '$250.00', '$125.75']  # Contains $ and text\n})\n\nprint(\"📊 Messy Data with Conversion Challenges:\")\nprint(messy_numbers)\nprint()\n\nprint(\"🛠️ Safe Conversion Strategies:\")\nprint()\n\nprint(\"1️⃣ Handle N/A values in scores:\")\n# Convert 'N/A' to NaN, then to numeric\nmessy_numbers['score_clean'] = messy_numbers['score'].replace('N/A', np.nan)\nmessy_numbers['score_clean'] = pd.to_numeric(messy_numbers['score_clean'])\nprint(\"Clean scores:\")\nprint(messy_numbers[['score', 'score_clean']])\nprint()\n\nprint(\"2️⃣ Clean percentage data:\")\n# Remove % symbol and convert\nmessy_numbers['percentage_clean'] = messy_numbers['percentage'].str.replace('%', '')\nmessy_numbers['percentage_clean'] = pd.to_numeric(\n    messy_numbers['percentage_clean'], errors='coerce'\n)\nprint(\"Clean percentages:\")\nprint(messy_numbers[['percentage', 'percentage_clean']])\nprint()\n\nprint(\"3️⃣ Clean currency data:\")\n# Remove $ symbol and handle 'free'\nmessy_numbers['amount_clean'] = messy_numbers['amount'].str.replace('$', '')\nmessy_numbers['amount_clean'] = messy_numbers['amount_clean'].replace('free', '0')\nmessy_numbers['amount_clean'] = pd.to_numeric(messy_numbers['amount_clean'])\nprint(\"Clean amounts:\")\nprint(messy_numbers[['amount', 'amount_clean']])\nprint()\n\nprint(\"4️⃣ Summary of conversions:\")\nprint(\"Successful conversions:\", messy_numbers['score_clean'].notna().sum(), \"out of\", len(messy_numbers))\nprint(\"Data types:\", messy_numbers[['score_clean', 'percentage_clean', 'amount_clean']].dtypes.to_dict())\n",[4985],{"type":393,"tag":441,"props":4986,"children":4987},{"__ignoreMap":6},[4988,5007,5028,5035,5043,5059,5111,5173,5235,5297,5304,5311,5331,5343,5354,5361,5381,5392,5399,5419,5427,5472,5504,5524,5552,5563,5570,5590,5598,5650,5674,5705,5712,5732,5759,5770,5777,5797,5805,5855,5902,5933,5953,5980,5991,5998,6018,6068],{"type":393,"tag":601,"props":4989,"children":4990},{"class":603,"line":11},[4991,4995,4999,5003],{"type":393,"tag":601,"props":4992,"children":4993},{"style":607},[4994],{"type":398,"value":610},{"type":393,"tag":601,"props":4996,"children":4997},{"style":613},[4998],{"type":398,"value":616},{"type":393,"tag":601,"props":5000,"children":5001},{"style":607},[5002],{"type":398,"value":621},{"type":393,"tag":601,"props":5004,"children":5005},{"style":613},[5006],{"type":398,"value":626},{"type":393,"tag":601,"props":5008,"children":5009},{"class":603,"line":27},[5010,5014,5019,5023],{"type":393,"tag":601,"props":5011,"children":5012},{"style":607},[5013],{"type":398,"value":610},{"type":393,"tag":601,"props":5015,"children":5016},{"style":613},[5017],{"type":398,"value":5018}," numpy ",{"type":393,"tag":601,"props":5020,"children":5021},{"style":607},[5022],{"type":398,"value":621},{"type":393,"tag":601,"props":5024,"children":5025},{"style":613},[5026],{"type":398,"value":5027}," np\n",{"type":393,"tag":601,"props":5029,"children":5030},{"class":603,"line":36},[5031],{"type":393,"tag":601,"props":5032,"children":5033},{"emptyLinePlaceholder":12},[5034],{"type":398,"value":634},{"type":393,"tag":601,"props":5036,"children":5037},{"class":603,"line":45},[5038],{"type":393,"tag":601,"props":5039,"children":5040},{"style":640},[5041],{"type":398,"value":5042},"# Messy data with conversion challenges\n",{"type":393,"tag":601,"props":5044,"children":5045},{"class":603,"line":54},[5046,5051,5055],{"type":393,"tag":601,"props":5047,"children":5048},{"style":613},[5049],{"type":398,"value":5050},"messy_numbers ",{"type":393,"tag":601,"props":5052,"children":5053},{"style":607},[5054],{"type":398,"value":656},{"type":393,"tag":601,"props":5056,"children":5057},{"style":613},[5058],{"type":398,"value":661},{"type":393,"tag":601,"props":5060,"children":5061},{"class":603,"line":63},[5062,5067,5071,5075,5079,5083,5087,5091,5095,5099,5103,5107],{"type":393,"tag":601,"props":5063,"children":5064},{"style":667},[5065],{"type":398,"value":5066},"    'id'",{"type":393,"tag":601,"props":5068,"children":5069},{"style":613},[5070],{"type":398,"value":675},{"type":393,"tag":601,"props":5072,"children":5073},{"style":667},[5074],{"type":398,"value":680},{"type":393,"tag":601,"props":5076,"children":5077},{"style":613},[5078],{"type":398,"value":685},{"type":393,"tag":601,"props":5080,"children":5081},{"style":667},[5082],{"type":398,"value":690},{"type":393,"tag":601,"props":5084,"children":5085},{"style":613},[5086],{"type":398,"value":685},{"type":393,"tag":601,"props":5088,"children":5089},{"style":667},[5090],{"type":398,"value":699},{"type":393,"tag":601,"props":5092,"children":5093},{"style":613},[5094],{"type":398,"value":685},{"type":393,"tag":601,"props":5096,"children":5097},{"style":667},[5098],{"type":398,"value":708},{"type":393,"tag":601,"props":5100,"children":5101},{"style":613},[5102],{"type":398,"value":685},{"type":393,"tag":601,"props":5104,"children":5105},{"style":667},[5106],{"type":398,"value":717},{"type":393,"tag":601,"props":5108,"children":5109},{"style":613},[5110],{"type":398,"value":1432},{"type":393,"tag":601,"props":5112,"children":5113},{"class":603,"line":72},[5114,5119,5123,5128,5132,5137,5141,5146,5150,5155,5159,5164,5168],{"type":393,"tag":601,"props":5115,"children":5116},{"style":667},[5117],{"type":398,"value":5118},"    'score'",{"type":393,"tag":601,"props":5120,"children":5121},{"style":613},[5122],{"type":398,"value":675},{"type":393,"tag":601,"props":5124,"children":5125},{"style":667},[5126],{"type":398,"value":5127},"'85'",{"type":393,"tag":601,"props":5129,"children":5130},{"style":613},[5131],{"type":398,"value":685},{"type":393,"tag":601,"props":5133,"children":5134},{"style":667},[5135],{"type":398,"value":5136},"'92'",{"type":393,"tag":601,"props":5138,"children":5139},{"style":613},[5140],{"type":398,"value":685},{"type":393,"tag":601,"props":5142,"children":5143},{"style":667},[5144],{"type":398,"value":5145},"'N/A'",{"type":393,"tag":601,"props":5147,"children":5148},{"style":613},[5149],{"type":398,"value":685},{"type":393,"tag":601,"props":5151,"children":5152},{"style":667},[5153],{"type":398,"value":5154},"'78'",{"type":393,"tag":601,"props":5156,"children":5157},{"style":613},[5158],{"type":398,"value":685},{"type":393,"tag":601,"props":5160,"children":5161},{"style":667},[5162],{"type":398,"value":5163},"'88'",{"type":393,"tag":601,"props":5165,"children":5166},{"style":613},[5167],{"type":398,"value":722},{"type":393,"tag":601,"props":5169,"children":5170},{"style":640},[5171],{"type":398,"value":5172},"# Contains N/A\n",{"type":393,"tag":601,"props":5174,"children":5175},{"class":603,"line":83},[5176,5181,5185,5190,5194,5199,5203,5208,5212,5217,5221,5226,5230],{"type":393,"tag":601,"props":5177,"children":5178},{"style":667},[5179],{"type":398,"value":5180},"    'percentage'",{"type":393,"tag":601,"props":5182,"children":5183},{"style":613},[5184],{"type":398,"value":675},{"type":393,"tag":601,"props":5186,"children":5187},{"style":667},[5188],{"type":398,"value":5189},"'15%'",{"type":393,"tag":601,"props":5191,"children":5192},{"style":613},[5193],{"type":398,"value":685},{"type":393,"tag":601,"props":5195,"children":5196},{"style":667},[5197],{"type":398,"value":5198},"'23%'",{"type":393,"tag":601,"props":5200,"children":5201},{"style":613},[5202],{"type":398,"value":685},{"type":393,"tag":601,"props":5204,"children":5205},{"style":667},[5206],{"type":398,"value":5207},"'8%'",{"type":393,"tag":601,"props":5209,"children":5210},{"style":613},[5211],{"type":398,"value":685},{"type":393,"tag":601,"props":5213,"children":5214},{"style":667},[5215],{"type":398,"value":5216},"'missing'",{"type":393,"tag":601,"props":5218,"children":5219},{"style":613},[5220],{"type":398,"value":685},{"type":393,"tag":601,"props":5222,"children":5223},{"style":667},[5224],{"type":398,"value":5225},"'45%'",{"type":393,"tag":601,"props":5227,"children":5228},{"style":613},[5229],{"type":398,"value":722},{"type":393,"tag":601,"props":5231,"children":5232},{"style":640},[5233],{"type":398,"value":5234},"# Contains % and text\n",{"type":393,"tag":601,"props":5236,"children":5237},{"class":603,"line":92},[5238,5243,5247,5252,5256,5261,5265,5270,5274,5279,5283,5288,5292],{"type":393,"tag":601,"props":5239,"children":5240},{"style":667},[5241],{"type":398,"value":5242},"    'amount'",{"type":393,"tag":601,"props":5244,"children":5245},{"style":613},[5246],{"type":398,"value":675},{"type":393,"tag":601,"props":5248,"children":5249},{"style":667},[5250],{"type":398,"value":5251},"'$100.50'",{"type":393,"tag":601,"props":5253,"children":5254},{"style":613},[5255],{"type":398,"value":685},{"type":393,"tag":601,"props":5257,"children":5258},{"style":667},[5259],{"type":398,"value":5260},"'$75.25'",{"type":393,"tag":601,"props":5262,"children":5263},{"style":613},[5264],{"type":398,"value":685},{"type":393,"tag":601,"props":5266,"children":5267},{"style":667},[5268],{"type":398,"value":5269},"'free'",{"type":393,"tag":601,"props":5271,"children":5272},{"style":613},[5273],{"type":398,"value":685},{"type":393,"tag":601,"props":5275,"children":5276},{"style":667},[5277],{"type":398,"value":5278},"'$250.00'",{"type":393,"tag":601,"props":5280,"children":5281},{"style":613},[5282],{"type":398,"value":685},{"type":393,"tag":601,"props":5284,"children":5285},{"style":667},[5286],{"type":398,"value":5287},"'$125.75'",{"type":393,"tag":601,"props":5289,"children":5290},{"style":613},[5291],{"type":398,"value":1029},{"type":393,"tag":601,"props":5293,"children":5294},{"style":640},[5295],{"type":398,"value":5296},"# Contains $ and text\n",{"type":393,"tag":601,"props":5298,"children":5299},{"class":603,"line":101},[5300],{"type":393,"tag":601,"props":5301,"children":5302},{"style":613},[5303],{"type":398,"value":1041},{"type":393,"tag":601,"props":5305,"children":5306},{"class":603,"line":110},[5307],{"type":393,"tag":601,"props":5308,"children":5309},{"emptyLinePlaceholder":12},[5310],{"type":398,"value":634},{"type":393,"tag":601,"props":5312,"children":5313},{"class":603,"line":121},[5314,5318,5322,5327],{"type":393,"tag":601,"props":5315,"children":5316},{"style":1054},[5317],{"type":398,"value":1057},{"type":393,"tag":601,"props":5319,"children":5320},{"style":613},[5321],{"type":398,"value":1062},{"type":393,"tag":601,"props":5323,"children":5324},{"style":667},[5325],{"type":398,"value":5326},"\"📊 Messy Data with Conversion Challenges:\"",{"type":393,"tag":601,"props":5328,"children":5329},{"style":613},[5330],{"type":398,"value":1072},{"type":393,"tag":601,"props":5332,"children":5333},{"class":603,"line":130},[5334,5338],{"type":393,"tag":601,"props":5335,"children":5336},{"style":1054},[5337],{"type":398,"value":1057},{"type":393,"tag":601,"props":5339,"children":5340},{"style":613},[5341],{"type":398,"value":5342},"(messy_numbers)\n",{"type":393,"tag":601,"props":5344,"children":5345},{"class":603,"line":139},[5346,5350],{"type":393,"tag":601,"props":5347,"children":5348},{"style":1054},[5349],{"type":398,"value":1057},{"type":393,"tag":601,"props":5351,"children":5352},{"style":613},[5353],{"type":398,"value":1096},{"type":393,"tag":601,"props":5355,"children":5356},{"class":603,"line":148},[5357],{"type":393,"tag":601,"props":5358,"children":5359},{"emptyLinePlaceholder":12},[5360],{"type":398,"value":634},{"type":393,"tag":601,"props":5362,"children":5363},{"class":603,"line":159},[5364,5368,5372,5377],{"type":393,"tag":601,"props":5365,"children":5366},{"style":1054},[5367],{"type":398,"value":1057},{"type":393,"tag":601,"props":5369,"children":5370},{"style":613},[5371],{"type":398,"value":1062},{"type":393,"tag":601,"props":5373,"children":5374},{"style":667},[5375],{"type":398,"value":5376},"\"🛠️ Safe Conversion Strategies:\"",{"type":393,"tag":601,"props":5378,"children":5379},{"style":613},[5380],{"type":398,"value":1072},{"type":393,"tag":601,"props":5382,"children":5383},{"class":603,"line":168},[5384,5388],{"type":393,"tag":601,"props":5385,"children":5386},{"style":1054},[5387],{"type":398,"value":1057},{"type":393,"tag":601,"props":5389,"children":5390},{"style":613},[5391],{"type":398,"value":1096},{"type":393,"tag":601,"props":5393,"children":5394},{"class":603,"line":177},[5395],{"type":393,"tag":601,"props":5396,"children":5397},{"emptyLinePlaceholder":12},[5398],{"type":398,"value":634},{"type":393,"tag":601,"props":5400,"children":5401},{"class":603,"line":186},[5402,5406,5410,5415],{"type":393,"tag":601,"props":5403,"children":5404},{"style":1054},[5405],{"type":398,"value":1057},{"type":393,"tag":601,"props":5407,"children":5408},{"style":613},[5409],{"type":398,"value":1062},{"type":393,"tag":601,"props":5411,"children":5412},{"style":667},[5413],{"type":398,"value":5414},"\"1️⃣ Handle N/A values in scores:\"",{"type":393,"tag":601,"props":5416,"children":5417},{"style":613},[5418],{"type":398,"value":1072},{"type":393,"tag":601,"props":5420,"children":5421},{"class":603,"line":197},[5422],{"type":393,"tag":601,"props":5423,"children":5424},{"style":640},[5425],{"type":398,"value":5426},"# Convert 'N/A' to NaN, then to numeric\n",{"type":393,"tag":601,"props":5428,"children":5429},{"class":603,"line":206},[5430,5435,5440,5444,5448,5453,5458,5463,5467],{"type":393,"tag":601,"props":5431,"children":5432},{"style":613},[5433],{"type":398,"value":5434},"messy_numbers[",{"type":393,"tag":601,"props":5436,"children":5437},{"style":667},[5438],{"type":398,"value":5439},"'score_clean'",{"type":393,"tag":601,"props":5441,"children":5442},{"style":613},[5443],{"type":398,"value":1759},{"type":393,"tag":601,"props":5445,"children":5446},{"style":607},[5447],{"type":398,"value":656},{"type":393,"tag":601,"props":5449,"children":5450},{"style":613},[5451],{"type":398,"value":5452}," messy_numbers[",{"type":393,"tag":601,"props":5454,"children":5455},{"style":667},[5456],{"type":398,"value":5457},"'score'",{"type":393,"tag":601,"props":5459,"children":5460},{"style":613},[5461],{"type":398,"value":5462},"].replace(",{"type":393,"tag":601,"props":5464,"children":5465},{"style":667},[5466],{"type":398,"value":5145},{"type":393,"tag":601,"props":5468,"children":5469},{"style":613},[5470],{"type":398,"value":5471},", np.nan)\n",{"type":393,"tag":601,"props":5473,"children":5474},{"class":603,"line":215},[5475,5479,5483,5487,5491,5496,5500],{"type":393,"tag":601,"props":5476,"children":5477},{"style":613},[5478],{"type":398,"value":5434},{"type":393,"tag":601,"props":5480,"children":5481},{"style":667},[5482],{"type":398,"value":5439},{"type":393,"tag":601,"props":5484,"children":5485},{"style":613},[5486],{"type":398,"value":1759},{"type":393,"tag":601,"props":5488,"children":5489},{"style":607},[5490],{"type":398,"value":656},{"type":393,"tag":601,"props":5492,"children":5493},{"style":613},[5494],{"type":398,"value":5495}," pd.to_numeric(messy_numbers[",{"type":393,"tag":601,"props":5497,"children":5498},{"style":667},[5499],{"type":398,"value":5439},{"type":393,"tag":601,"props":5501,"children":5502},{"style":613},[5503],{"type":398,"value":2016},{"type":393,"tag":601,"props":5505,"children":5506},{"class":603,"line":224},[5507,5511,5515,5520],{"type":393,"tag":601,"props":5508,"children":5509},{"style":1054},[5510],{"type":398,"value":1057},{"type":393,"tag":601,"props":5512,"children":5513},{"style":613},[5514],{"type":398,"value":1062},{"type":393,"tag":601,"props":5516,"children":5517},{"style":667},[5518],{"type":398,"value":5519},"\"Clean scores:\"",{"type":393,"tag":601,"props":5521,"children":5522},{"style":613},[5523],{"type":398,"value":1072},{"type":393,"tag":601,"props":5525,"children":5526},{"class":603,"line":233},[5527,5531,5536,5540,5544,5548],{"type":393,"tag":601,"props":5528,"children":5529},{"style":1054},[5530],{"type":398,"value":1057},{"type":393,"tag":601,"props":5532,"children":5533},{"style":613},[5534],{"type":398,"value":5535},"(messy_numbers[[",{"type":393,"tag":601,"props":5537,"children":5538},{"style":667},[5539],{"type":398,"value":5457},{"type":393,"tag":601,"props":5541,"children":5542},{"style":613},[5543],{"type":398,"value":685},{"type":393,"tag":601,"props":5545,"children":5546},{"style":667},[5547],{"type":398,"value":5439},{"type":393,"tag":601,"props":5549,"children":5550},{"style":613},[5551],{"type":398,"value":3012},{"type":393,"tag":601,"props":5553,"children":5554},{"class":603,"line":244},[5555,5559],{"type":393,"tag":601,"props":5556,"children":5557},{"style":1054},[5558],{"type":398,"value":1057},{"type":393,"tag":601,"props":5560,"children":5561},{"style":613},[5562],{"type":398,"value":1096},{"type":393,"tag":601,"props":5564,"children":5565},{"class":603,"line":253},[5566],{"type":393,"tag":601,"props":5567,"children":5568},{"emptyLinePlaceholder":12},[5569],{"type":398,"value":634},{"type":393,"tag":601,"props":5571,"children":5572},{"class":603,"line":262},[5573,5577,5581,5586],{"type":393,"tag":601,"props":5574,"children":5575},{"style":1054},[5576],{"type":398,"value":1057},{"type":393,"tag":601,"props":5578,"children":5579},{"style":613},[5580],{"type":398,"value":1062},{"type":393,"tag":601,"props":5582,"children":5583},{"style":667},[5584],{"type":398,"value":5585},"\"2️⃣ Clean percentage data:\"",{"type":393,"tag":601,"props":5587,"children":5588},{"style":613},[5589],{"type":398,"value":1072},{"type":393,"tag":601,"props":5591,"children":5592},{"class":603,"line":271},[5593],{"type":393,"tag":601,"props":5594,"children":5595},{"style":640},[5596],{"type":398,"value":5597},"# Remove % symbol and convert\n",{"type":393,"tag":601,"props":5599,"children":5600},{"class":603,"line":281},[5601,5605,5610,5614,5618,5622,5627,5632,5637,5641,5646],{"type":393,"tag":601,"props":5602,"children":5603},{"style":613},[5604],{"type":398,"value":5434},{"type":393,"tag":601,"props":5606,"children":5607},{"style":667},[5608],{"type":398,"value":5609},"'percentage_clean'",{"type":393,"tag":601,"props":5611,"children":5612},{"style":613},[5613],{"type":398,"value":1759},{"type":393,"tag":601,"props":5615,"children":5616},{"style":607},[5617],{"type":398,"value":656},{"type":393,"tag":601,"props":5619,"children":5620},{"style":613},[5621],{"type":398,"value":5452},{"type":393,"tag":601,"props":5623,"children":5624},{"style":667},[5625],{"type":398,"value":5626},"'percentage'",{"type":393,"tag":601,"props":5628,"children":5629},{"style":613},[5630],{"type":398,"value":5631},"].str.replace(",{"type":393,"tag":601,"props":5633,"children":5634},{"style":667},[5635],{"type":398,"value":5636},"'%'",{"type":393,"tag":601,"props":5638,"children":5639},{"style":613},[5640],{"type":398,"value":685},{"type":393,"tag":601,"props":5642,"children":5643},{"style":667},[5644],{"type":398,"value":5645},"''",{"type":393,"tag":601,"props":5647,"children":5648},{"style":613},[5649],{"type":398,"value":1072},{"type":393,"tag":601,"props":5651,"children":5652},{"class":603,"line":290},[5653,5657,5661,5665,5669],{"type":393,"tag":601,"props":5654,"children":5655},{"style":613},[5656],{"type":398,"value":5434},{"type":393,"tag":601,"props":5658,"children":5659},{"style":667},[5660],{"type":398,"value":5609},{"type":393,"tag":601,"props":5662,"children":5663},{"style":613},[5664],{"type":398,"value":1759},{"type":393,"tag":601,"props":5666,"children":5667},{"style":607},[5668],{"type":398,"value":656},{"type":393,"tag":601,"props":5670,"children":5671},{"style":613},[5672],{"type":398,"value":5673}," pd.to_numeric(\n",{"type":393,"tag":601,"props":5675,"children":5676},{"class":603,"line":299},[5677,5682,5686,5691,5696,5700],{"type":393,"tag":601,"props":5678,"children":5679},{"style":613},[5680],{"type":398,"value":5681},"    messy_numbers[",{"type":393,"tag":601,"props":5683,"children":5684},{"style":667},[5685],{"type":398,"value":5609},{"type":393,"tag":601,"props":5687,"children":5688},{"style":613},[5689],{"type":398,"value":5690},"], ",{"type":393,"tag":601,"props":5692,"children":5693},{"style":4420},[5694],{"type":398,"value":5695},"errors",{"type":393,"tag":601,"props":5697,"children":5698},{"style":607},[5699],{"type":398,"value":656},{"type":393,"tag":601,"props":5701,"children":5702},{"style":667},[5703],{"type":398,"value":5704},"'coerce'\n",{"type":393,"tag":601,"props":5706,"children":5707},{"class":603,"line":308},[5708],{"type":393,"tag":601,"props":5709,"children":5710},{"style":613},[5711],{"type":398,"value":1072},{"type":393,"tag":601,"props":5713,"children":5714},{"class":603,"line":318},[5715,5719,5723,5728],{"type":393,"tag":601,"props":5716,"children":5717},{"style":1054},[5718],{"type":398,"value":1057},{"type":393,"tag":601,"props":5720,"children":5721},{"style":613},[5722],{"type":398,"value":1062},{"type":393,"tag":601,"props":5724,"children":5725},{"style":667},[5726],{"type":398,"value":5727},"\"Clean percentages:\"",{"type":393,"tag":601,"props":5729,"children":5730},{"style":613},[5731],{"type":398,"value":1072},{"type":393,"tag":601,"props":5733,"children":5734},{"class":603,"line":327},[5735,5739,5743,5747,5751,5755],{"type":393,"tag":601,"props":5736,"children":5737},{"style":1054},[5738],{"type":398,"value":1057},{"type":393,"tag":601,"props":5740,"children":5741},{"style":613},[5742],{"type":398,"value":5535},{"type":393,"tag":601,"props":5744,"children":5745},{"style":667},[5746],{"type":398,"value":5626},{"type":393,"tag":601,"props":5748,"children":5749},{"style":613},[5750],{"type":398,"value":685},{"type":393,"tag":601,"props":5752,"children":5753},{"style":667},[5754],{"type":398,"value":5609},{"type":393,"tag":601,"props":5756,"children":5757},{"style":613},[5758],{"type":398,"value":3012},{"type":393,"tag":601,"props":5760,"children":5761},{"class":603,"line":336},[5762,5766],{"type":393,"tag":601,"props":5763,"children":5764},{"style":1054},[5765],{"type":398,"value":1057},{"type":393,"tag":601,"props":5767,"children":5768},{"style":613},[5769],{"type":398,"value":1096},{"type":393,"tag":601,"props":5771,"children":5772},{"class":603,"line":346},[5773],{"type":393,"tag":601,"props":5774,"children":5775},{"emptyLinePlaceholder":12},[5776],{"type":398,"value":634},{"type":393,"tag":601,"props":5778,"children":5779},{"class":603,"line":355},[5780,5784,5788,5793],{"type":393,"tag":601,"props":5781,"children":5782},{"style":1054},[5783],{"type":398,"value":1057},{"type":393,"tag":601,"props":5785,"children":5786},{"style":613},[5787],{"type":398,"value":1062},{"type":393,"tag":601,"props":5789,"children":5790},{"style":667},[5791],{"type":398,"value":5792},"\"3️⃣ Clean currency data:\"",{"type":393,"tag":601,"props":5794,"children":5795},{"style":613},[5796],{"type":398,"value":1072},{"type":393,"tag":601,"props":5798,"children":5799},{"class":603,"line":364},[5800],{"type":393,"tag":601,"props":5801,"children":5802},{"style":640},[5803],{"type":398,"value":5804},"# Remove $ symbol and handle 'free'\n",{"type":393,"tag":601,"props":5806,"children":5807},{"class":603,"line":374},[5808,5812,5817,5821,5825,5829,5834,5838,5843,5847,5851],{"type":393,"tag":601,"props":5809,"children":5810},{"style":613},[5811],{"type":398,"value":5434},{"type":393,"tag":601,"props":5813,"children":5814},{"style":667},[5815],{"type":398,"value":5816},"'amount_clean'",{"type":393,"tag":601,"props":5818,"children":5819},{"style":613},[5820],{"type":398,"value":1759},{"type":393,"tag":601,"props":5822,"children":5823},{"style":607},[5824],{"type":398,"value":656},{"type":393,"tag":601,"props":5826,"children":5827},{"style":613},[5828],{"type":398,"value":5452},{"type":393,"tag":601,"props":5830,"children":5831},{"style":667},[5832],{"type":398,"value":5833},"'amount'",{"type":393,"tag":601,"props":5835,"children":5836},{"style":613},[5837],{"type":398,"value":5631},{"type":393,"tag":601,"props":5839,"children":5840},{"style":667},[5841],{"type":398,"value":5842},"'$'",{"type":393,"tag":601,"props":5844,"children":5845},{"style":613},[5846],{"type":398,"value":685},{"type":393,"tag":601,"props":5848,"children":5849},{"style":667},[5850],{"type":398,"value":5645},{"type":393,"tag":601,"props":5852,"children":5853},{"style":613},[5854],{"type":398,"value":1072},{"type":393,"tag":601,"props":5856,"children":5857},{"class":603,"line":383},[5858,5862,5866,5870,5874,5878,5882,5886,5890,5894,5898],{"type":393,"tag":601,"props":5859,"children":5860},{"style":613},[5861],{"type":398,"value":5434},{"type":393,"tag":601,"props":5863,"children":5864},{"style":667},[5865],{"type":398,"value":5816},{"type":393,"tag":601,"props":5867,"children":5868},{"style":613},[5869],{"type":398,"value":1759},{"type":393,"tag":601,"props":5871,"children":5872},{"style":607},[5873],{"type":398,"value":656},{"type":393,"tag":601,"props":5875,"children":5876},{"style":613},[5877],{"type":398,"value":5452},{"type":393,"tag":601,"props":5879,"children":5880},{"style":667},[5881],{"type":398,"value":5816},{"type":393,"tag":601,"props":5883,"children":5884},{"style":613},[5885],{"type":398,"value":5462},{"type":393,"tag":601,"props":5887,"children":5888},{"style":667},[5889],{"type":398,"value":5269},{"type":393,"tag":601,"props":5891,"children":5892},{"style":613},[5893],{"type":398,"value":685},{"type":393,"tag":601,"props":5895,"children":5896},{"style":667},[5897],{"type":398,"value":3267},{"type":393,"tag":601,"props":5899,"children":5900},{"style":613},[5901],{"type":398,"value":1072},{"type":393,"tag":601,"props":5903,"children":5904},{"class":603,"line":3949},[5905,5909,5913,5917,5921,5925,5929],{"type":393,"tag":601,"props":5906,"children":5907},{"style":613},[5908],{"type":398,"value":5434},{"type":393,"tag":601,"props":5910,"children":5911},{"style":667},[5912],{"type":398,"value":5816},{"type":393,"tag":601,"props":5914,"children":5915},{"style":613},[5916],{"type":398,"value":1759},{"type":393,"tag":601,"props":5918,"children":5919},{"style":607},[5920],{"type":398,"value":656},{"type":393,"tag":601,"props":5922,"children":5923},{"style":613},[5924],{"type":398,"value":5495},{"type":393,"tag":601,"props":5926,"children":5927},{"style":667},[5928],{"type":398,"value":5816},{"type":393,"tag":601,"props":5930,"children":5931},{"style":613},[5932],{"type":398,"value":2016},{"type":393,"tag":601,"props":5934,"children":5935},{"class":603,"line":3961},[5936,5940,5944,5949],{"type":393,"tag":601,"props":5937,"children":5938},{"style":1054},[5939],{"type":398,"value":1057},{"type":393,"tag":601,"props":5941,"children":5942},{"style":613},[5943],{"type":398,"value":1062},{"type":393,"tag":601,"props":5945,"children":5946},{"style":667},[5947],{"type":398,"value":5948},"\"Clean amounts:\"",{"type":393,"tag":601,"props":5950,"children":5951},{"style":613},[5952],{"type":398,"value":1072},{"type":393,"tag":601,"props":5954,"children":5955},{"class":603,"line":3969},[5956,5960,5964,5968,5972,5976],{"type":393,"tag":601,"props":5957,"children":5958},{"style":1054},[5959],{"type":398,"value":1057},{"type":393,"tag":601,"props":5961,"children":5962},{"style":613},[5963],{"type":398,"value":5535},{"type":393,"tag":601,"props":5965,"children":5966},{"style":667},[5967],{"type":398,"value":5833},{"type":393,"tag":601,"props":5969,"children":5970},{"style":613},[5971],{"type":398,"value":685},{"type":393,"tag":601,"props":5973,"children":5974},{"style":667},[5975],{"type":398,"value":5816},{"type":393,"tag":601,"props":5977,"children":5978},{"style":613},[5979],{"type":398,"value":3012},{"type":393,"tag":601,"props":5981,"children":5982},{"class":603,"line":3990},[5983,5987],{"type":393,"tag":601,"props":5984,"children":5985},{"style":1054},[5986],{"type":398,"value":1057},{"type":393,"tag":601,"props":5988,"children":5989},{"style":613},[5990],{"type":398,"value":1096},{"type":393,"tag":601,"props":5992,"children":5993},{"class":603,"line":4927},[5994],{"type":393,"tag":601,"props":5995,"children":5996},{"emptyLinePlaceholder":12},[5997],{"type":398,"value":634},{"type":393,"tag":601,"props":5999,"children":6000},{"class":603,"line":4948},[6001,6005,6009,6014],{"type":393,"tag":601,"props":6002,"children":6003},{"style":1054},[6004],{"type":398,"value":1057},{"type":393,"tag":601,"props":6006,"children":6007},{"style":613},[6008],{"type":398,"value":1062},{"type":393,"tag":601,"props":6010,"children":6011},{"style":667},[6012],{"type":398,"value":6013},"\"4️⃣ Summary of conversions:\"",{"type":393,"tag":601,"props":6015,"children":6016},{"style":613},[6017],{"type":398,"value":1072},{"type":393,"tag":601,"props":6019,"children":6021},{"class":603,"line":6020},47,[6022,6026,6030,6035,6040,6044,6049,6054,6058,6063],{"type":393,"tag":601,"props":6023,"children":6024},{"style":1054},[6025],{"type":398,"value":1057},{"type":393,"tag":601,"props":6027,"children":6028},{"style":613},[6029],{"type":398,"value":1062},{"type":393,"tag":601,"props":6031,"children":6032},{"style":667},[6033],{"type":398,"value":6034},"\"Successful conversions:\"",{"type":393,"tag":601,"props":6036,"children":6037},{"style":613},[6038],{"type":398,"value":6039},", messy_numbers[",{"type":393,"tag":601,"props":6041,"children":6042},{"style":667},[6043],{"type":398,"value":5439},{"type":393,"tag":601,"props":6045,"children":6046},{"style":613},[6047],{"type":398,"value":6048},"].notna().sum(), ",{"type":393,"tag":601,"props":6050,"children":6051},{"style":667},[6052],{"type":398,"value":6053},"\"out of\"",{"type":393,"tag":601,"props":6055,"children":6056},{"style":613},[6057],{"type":398,"value":685},{"type":393,"tag":601,"props":6059,"children":6060},{"style":1054},[6061],{"type":398,"value":6062},"len",{"type":393,"tag":601,"props":6064,"children":6065},{"style":613},[6066],{"type":398,"value":6067},"(messy_numbers))\n",{"type":393,"tag":601,"props":6069,"children":6071},{"class":603,"line":6070},48,[6072,6076,6080,6084,6089,6093,6097,6101,6105,6109],{"type":393,"tag":601,"props":6073,"children":6074},{"style":1054},[6075],{"type":398,"value":1057},{"type":393,"tag":601,"props":6077,"children":6078},{"style":613},[6079],{"type":398,"value":1062},{"type":393,"tag":601,"props":6081,"children":6082},{"style":667},[6083],{"type":398,"value":1635},{"type":393,"tag":601,"props":6085,"children":6086},{"style":613},[6087],{"type":398,"value":6088},", messy_numbers[[",{"type":393,"tag":601,"props":6090,"children":6091},{"style":667},[6092],{"type":398,"value":5439},{"type":393,"tag":601,"props":6094,"children":6095},{"style":613},[6096],{"type":398,"value":685},{"type":393,"tag":601,"props":6098,"children":6099},{"style":667},[6100],{"type":398,"value":5609},{"type":393,"tag":601,"props":6102,"children":6103},{"style":613},[6104],{"type":398,"value":685},{"type":393,"tag":601,"props":6106,"children":6107},{"style":667},[6108],{"type":398,"value":5816},{"type":393,"tag":601,"props":6110,"children":6111},{"style":613},[6112],{"type":398,"value":2503},{"type":393,"tag":575,"props":6114,"children":6116},{"id":6115},"complete-type-conversion-workflow",[6117],{"type":398,"value":6118},"🎯 Complete Type Conversion Workflow",{"type":393,"tag":401,"props":6120,"children":6121},{},[6122],{"type":398,"value":6123},"A systematic approach to fixing all data types:",{"type":393,"tag":587,"props":6125,"children":6126},{},[6127],{"type":393,"tag":591,"props":6128,"children":6130},{"className":593,"code":6129,"language":595,"meta":6,"style":6},"import pandas as pd\n\n# Complete messy dataset\nraw_data = pd.DataFrame({\n    'order_id': ['1001', '1002', '1003', '1004'],\n    'customer_name': ['Alice Johnson', 'Bob Smith', 'Charlie Brown', 'Diana Lee'],\n    'order_date': ['2023-03-15', '2023-03-16', '2023-03-17', '2023-03-18'],\n    'product_category': ['Electronics', 'Books', 'Electronics', 'Clothing'],\n    'quantity': ['2', '1', '3', '1'],\n    'unit_price': ['299.99', '19.95', '149.99', '49.99'],\n    'is_express_shipping': ['True', 'False', 'True', 'False'],\n    'customer_rating': ['5', '4', '5', '3']\n})\n\nprint(\"📊 Raw Data (All Wrong Types):\")\nprint(raw_data)\nprint(\"Original types:\", raw_data.dtypes.to_dict())\nprint()\n\nprint(\"🎯 Complete Type Conversion Workflow:\")\nprint()\n\n# Step 1: Create a copy for cleaning\ncleaned_data = raw_data.copy()\n\n# Step 2: Convert IDs to integers\nprint(\"1️⃣ Convert IDs to integers:\")\ncleaned_data['order_id'] = pd.to_numeric(cleaned_data['order_id'])\n\n# Step 3: Convert dates\nprint(\"2️⃣ Convert dates:\")\ncleaned_data['order_date'] = pd.to_datetime(cleaned_data['order_date'])\n\n# Step 4: Convert categories\nprint(\"3️⃣ Convert categories:\")\ncleaned_data['product_category'] = cleaned_data['product_category'].astype('category')\n\n# Step 5: Convert numeric columns\nprint(\"4️⃣ Convert numeric columns:\")\ncleaned_data['quantity'] = pd.to_numeric(cleaned_data['quantity'])\ncleaned_data['unit_price'] = pd.to_numeric(cleaned_data['unit_price'])\ncleaned_data['customer_rating'] = pd.to_numeric(cleaned_data['customer_rating'])\n\n# Step 6: Convert boolean\nprint(\"5️⃣ Convert boolean:\")\ncleaned_data['is_express_shipping'] = cleaned_data['is_express_shipping'] == 'True'\n\nprint(\"✅ Final cleaned data:\")\nprint(cleaned_data)\nprint()\nprint(\"New types:\", cleaned_data.dtypes.to_dict())\nprint()\n\nprint(\"🎯 Now we can do proper analysis:\")\nprint(f\"Average order value: ${(cleaned_data['quantity'] * cleaned_data['unit_price']).mean():.2f}\")\nprint(f\"Express shipping rate: {cleaned_data['is_express_shipping'].mean():.1%}\")\nprint(f\"Average rating: {cleaned_data['customer_rating'].mean():.1f}/5\")\n",[6131],{"type":393,"tag":441,"props":6132,"children":6133},{"__ignoreMap":6},[6134,6153,6160,6168,6184,6232,6280,6326,6373,6416,6464,6508,6552,6559,6566,6586,6598,6619,6630,6637,6657,6668,6675,6683,6700,6707,6715,6735,6769,6776,6784,6804,6837,6844,6852,6872,6913,6920,6928,6948,6979,7011,7043,7050,7058,7078,7118,7125,7145,7158,7170,7191,7203,7211,7232,7309,7364],{"type":393,"tag":601,"props":6135,"children":6136},{"class":603,"line":11},[6137,6141,6145,6149],{"type":393,"tag":601,"props":6138,"children":6139},{"style":607},[6140],{"type":398,"value":610},{"type":393,"tag":601,"props":6142,"children":6143},{"style":613},[6144],{"type":398,"value":616},{"type":393,"tag":601,"props":6146,"children":6147},{"style":607},[6148],{"type":398,"value":621},{"type":393,"tag":601,"props":6150,"children":6151},{"style":613},[6152],{"type":398,"value":626},{"type":393,"tag":601,"props":6154,"children":6155},{"class":603,"line":27},[6156],{"type":393,"tag":601,"props":6157,"children":6158},{"emptyLinePlaceholder":12},[6159],{"type":398,"value":634},{"type":393,"tag":601,"props":6161,"children":6162},{"class":603,"line":36},[6163],{"type":393,"tag":601,"props":6164,"children":6165},{"style":640},[6166],{"type":398,"value":6167},"# Complete messy dataset\n",{"type":393,"tag":601,"props":6169,"children":6170},{"class":603,"line":45},[6171,6176,6180],{"type":393,"tag":601,"props":6172,"children":6173},{"style":613},[6174],{"type":398,"value":6175},"raw_data ",{"type":393,"tag":601,"props":6177,"children":6178},{"style":607},[6179],{"type":398,"value":656},{"type":393,"tag":601,"props":6181,"children":6182},{"style":613},[6183],{"type":398,"value":661},{"type":393,"tag":601,"props":6185,"children":6186},{"class":603,"line":54},[6187,6192,6196,6201,6205,6210,6214,6219,6223,6228],{"type":393,"tag":601,"props":6188,"children":6189},{"style":667},[6190],{"type":398,"value":6191},"    'order_id'",{"type":393,"tag":601,"props":6193,"children":6194},{"style":613},[6195],{"type":398,"value":675},{"type":393,"tag":601,"props":6197,"children":6198},{"style":667},[6199],{"type":398,"value":6200},"'1001'",{"type":393,"tag":601,"props":6202,"children":6203},{"style":613},[6204],{"type":398,"value":685},{"type":393,"tag":601,"props":6206,"children":6207},{"style":667},[6208],{"type":398,"value":6209},"'1002'",{"type":393,"tag":601,"props":6211,"children":6212},{"style":613},[6213],{"type":398,"value":685},{"type":393,"tag":601,"props":6215,"children":6216},{"style":667},[6217],{"type":398,"value":6218},"'1003'",{"type":393,"tag":601,"props":6220,"children":6221},{"style":613},[6222],{"type":398,"value":685},{"type":393,"tag":601,"props":6224,"children":6225},{"style":667},[6226],{"type":398,"value":6227},"'1004'",{"type":393,"tag":601,"props":6229,"children":6230},{"style":613},[6231],{"type":398,"value":1432},{"type":393,"tag":601,"props":6233,"children":6234},{"class":603,"line":63},[6235,6240,6244,6249,6253,6258,6262,6267,6271,6276],{"type":393,"tag":601,"props":6236,"children":6237},{"style":667},[6238],{"type":398,"value":6239},"    'customer_name'",{"type":393,"tag":601,"props":6241,"children":6242},{"style":613},[6243],{"type":398,"value":675},{"type":393,"tag":601,"props":6245,"children":6246},{"style":667},[6247],{"type":398,"value":6248},"'Alice Johnson'",{"type":393,"tag":601,"props":6250,"children":6251},{"style":613},[6252],{"type":398,"value":685},{"type":393,"tag":601,"props":6254,"children":6255},{"style":667},[6256],{"type":398,"value":6257},"'Bob Smith'",{"type":393,"tag":601,"props":6259,"children":6260},{"style":613},[6261],{"type":398,"value":685},{"type":393,"tag":601,"props":6263,"children":6264},{"style":667},[6265],{"type":398,"value":6266},"'Charlie Brown'",{"type":393,"tag":601,"props":6268,"children":6269},{"style":613},[6270],{"type":398,"value":685},{"type":393,"tag":601,"props":6272,"children":6273},{"style":667},[6274],{"type":398,"value":6275},"'Diana Lee'",{"type":393,"tag":601,"props":6277,"children":6278},{"style":613},[6279],{"type":398,"value":1432},{"type":393,"tag":601,"props":6281,"children":6282},{"class":603,"line":72},[6283,6288,6292,6296,6300,6304,6308,6313,6317,6322],{"type":393,"tag":601,"props":6284,"children":6285},{"style":667},[6286],{"type":398,"value":6287},"    'order_date'",{"type":393,"tag":601,"props":6289,"children":6290},{"style":613},[6291],{"type":398,"value":675},{"type":393,"tag":601,"props":6293,"children":6294},{"style":667},[6295],{"type":398,"value":2294},{"type":393,"tag":601,"props":6297,"children":6298},{"style":613},[6299],{"type":398,"value":685},{"type":393,"tag":601,"props":6301,"children":6302},{"style":667},[6303],{"type":398,"value":2342},{"type":393,"tag":601,"props":6305,"children":6306},{"style":613},[6307],{"type":398,"value":685},{"type":393,"tag":601,"props":6309,"children":6310},{"style":667},[6311],{"type":398,"value":6312},"'2023-03-17'",{"type":393,"tag":601,"props":6314,"children":6315},{"style":613},[6316],{"type":398,"value":685},{"type":393,"tag":601,"props":6318,"children":6319},{"style":667},[6320],{"type":398,"value":6321},"'2023-03-18'",{"type":393,"tag":601,"props":6323,"children":6324},{"style":613},[6325],{"type":398,"value":1432},{"type":393,"tag":601,"props":6327,"children":6328},{"class":603,"line":83},[6329,6334,6338,6343,6347,6352,6356,6360,6364,6369],{"type":393,"tag":601,"props":6330,"children":6331},{"style":667},[6332],{"type":398,"value":6333},"    'product_category'",{"type":393,"tag":601,"props":6335,"children":6336},{"style":613},[6337],{"type":398,"value":675},{"type":393,"tag":601,"props":6339,"children":6340},{"style":667},[6341],{"type":398,"value":6342},"'Electronics'",{"type":393,"tag":601,"props":6344,"children":6345},{"style":613},[6346],{"type":398,"value":685},{"type":393,"tag":601,"props":6348,"children":6349},{"style":667},[6350],{"type":398,"value":6351},"'Books'",{"type":393,"tag":601,"props":6353,"children":6354},{"style":613},[6355],{"type":398,"value":685},{"type":393,"tag":601,"props":6357,"children":6358},{"style":667},[6359],{"type":398,"value":6342},{"type":393,"tag":601,"props":6361,"children":6362},{"style":613},[6363],{"type":398,"value":685},{"type":393,"tag":601,"props":6365,"children":6366},{"style":667},[6367],{"type":398,"value":6368},"'Clothing'",{"type":393,"tag":601,"props":6370,"children":6371},{"style":613},[6372],{"type":398,"value":1432},{"type":393,"tag":601,"props":6374,"children":6375},{"class":603,"line":92},[6376,6380,6384,6388,6392,6396,6400,6404,6408,6412],{"type":393,"tag":601,"props":6377,"children":6378},{"style":667},[6379],{"type":398,"value":1488},{"type":393,"tag":601,"props":6381,"children":6382},{"style":613},[6383],{"type":398,"value":675},{"type":393,"tag":601,"props":6385,"children":6386},{"style":667},[6387],{"type":398,"value":690},{"type":393,"tag":601,"props":6389,"children":6390},{"style":613},[6391],{"type":398,"value":685},{"type":393,"tag":601,"props":6393,"children":6394},{"style":667},[6395],{"type":398,"value":680},{"type":393,"tag":601,"props":6397,"children":6398},{"style":613},[6399],{"type":398,"value":685},{"type":393,"tag":601,"props":6401,"children":6402},{"style":667},[6403],{"type":398,"value":699},{"type":393,"tag":601,"props":6405,"children":6406},{"style":613},[6407],{"type":398,"value":685},{"type":393,"tag":601,"props":6409,"children":6410},{"style":667},[6411],{"type":398,"value":680},{"type":393,"tag":601,"props":6413,"children":6414},{"style":613},[6415],{"type":398,"value":1432},{"type":393,"tag":601,"props":6417,"children":6418},{"class":603,"line":101},[6419,6424,6428,6433,6437,6442,6446,6451,6455,6460],{"type":393,"tag":601,"props":6420,"children":6421},{"style":667},[6422],{"type":398,"value":6423},"    'unit_price'",{"type":393,"tag":601,"props":6425,"children":6426},{"style":613},[6427],{"type":398,"value":675},{"type":393,"tag":601,"props":6429,"children":6430},{"style":667},[6431],{"type":398,"value":6432},"'299.99'",{"type":393,"tag":601,"props":6434,"children":6435},{"style":613},[6436],{"type":398,"value":685},{"type":393,"tag":601,"props":6438,"children":6439},{"style":667},[6440],{"type":398,"value":6441},"'19.95'",{"type":393,"tag":601,"props":6443,"children":6444},{"style":613},[6445],{"type":398,"value":685},{"type":393,"tag":601,"props":6447,"children":6448},{"style":667},[6449],{"type":398,"value":6450},"'149.99'",{"type":393,"tag":601,"props":6452,"children":6453},{"style":613},[6454],{"type":398,"value":685},{"type":393,"tag":601,"props":6456,"children":6457},{"style":667},[6458],{"type":398,"value":6459},"'49.99'",{"type":393,"tag":601,"props":6461,"children":6462},{"style":613},[6463],{"type":398,"value":1432},{"type":393,"tag":601,"props":6465,"children":6466},{"class":603,"line":110},[6467,6472,6476,6480,6484,6488,6492,6496,6500,6504],{"type":393,"tag":601,"props":6468,"children":6469},{"style":667},[6470],{"type":398,"value":6471},"    'is_express_shipping'",{"type":393,"tag":601,"props":6473,"children":6474},{"style":613},[6475],{"type":398,"value":675},{"type":393,"tag":601,"props":6477,"children":6478},{"style":667},[6479],{"type":398,"value":929},{"type":393,"tag":601,"props":6481,"children":6482},{"style":613},[6483],{"type":398,"value":685},{"type":393,"tag":601,"props":6485,"children":6486},{"style":667},[6487],{"type":398,"value":938},{"type":393,"tag":601,"props":6489,"children":6490},{"style":613},[6491],{"type":398,"value":685},{"type":393,"tag":601,"props":6493,"children":6494},{"style":667},[6495],{"type":398,"value":929},{"type":393,"tag":601,"props":6497,"children":6498},{"style":613},[6499],{"type":398,"value":685},{"type":393,"tag":601,"props":6501,"children":6502},{"style":667},[6503],{"type":398,"value":938},{"type":393,"tag":601,"props":6505,"children":6506},{"style":613},[6507],{"type":398,"value":1432},{"type":393,"tag":601,"props":6509,"children":6510},{"class":603,"line":121},[6511,6516,6520,6524,6528,6532,6536,6540,6544,6548],{"type":393,"tag":601,"props":6512,"children":6513},{"style":667},[6514],{"type":398,"value":6515},"    'customer_rating'",{"type":393,"tag":601,"props":6517,"children":6518},{"style":613},[6519],{"type":398,"value":675},{"type":393,"tag":601,"props":6521,"children":6522},{"style":667},[6523],{"type":398,"value":717},{"type":393,"tag":601,"props":6525,"children":6526},{"style":613},[6527],{"type":398,"value":685},{"type":393,"tag":601,"props":6529,"children":6530},{"style":667},[6531],{"type":398,"value":708},{"type":393,"tag":601,"props":6533,"children":6534},{"style":613},[6535],{"type":398,"value":685},{"type":393,"tag":601,"props":6537,"children":6538},{"style":667},[6539],{"type":398,"value":717},{"type":393,"tag":601,"props":6541,"children":6542},{"style":613},[6543],{"type":398,"value":685},{"type":393,"tag":601,"props":6545,"children":6546},{"style":667},[6547],{"type":398,"value":699},{"type":393,"tag":601,"props":6549,"children":6550},{"style":613},[6551],{"type":398,"value":1573},{"type":393,"tag":601,"props":6553,"children":6554},{"class":603,"line":130},[6555],{"type":393,"tag":601,"props":6556,"children":6557},{"style":613},[6558],{"type":398,"value":1041},{"type":393,"tag":601,"props":6560,"children":6561},{"class":603,"line":139},[6562],{"type":393,"tag":601,"props":6563,"children":6564},{"emptyLinePlaceholder":12},[6565],{"type":398,"value":634},{"type":393,"tag":601,"props":6567,"children":6568},{"class":603,"line":148},[6569,6573,6577,6582],{"type":393,"tag":601,"props":6570,"children":6571},{"style":1054},[6572],{"type":398,"value":1057},{"type":393,"tag":601,"props":6574,"children":6575},{"style":613},[6576],{"type":398,"value":1062},{"type":393,"tag":601,"props":6578,"children":6579},{"style":667},[6580],{"type":398,"value":6581},"\"📊 Raw Data (All Wrong Types):\"",{"type":393,"tag":601,"props":6583,"children":6584},{"style":613},[6585],{"type":398,"value":1072},{"type":393,"tag":601,"props":6587,"children":6588},{"class":603,"line":159},[6589,6593],{"type":393,"tag":601,"props":6590,"children":6591},{"style":1054},[6592],{"type":398,"value":1057},{"type":393,"tag":601,"props":6594,"children":6595},{"style":613},[6596],{"type":398,"value":6597},"(raw_data)\n",{"type":393,"tag":601,"props":6599,"children":6600},{"class":603,"line":168},[6601,6605,6609,6614],{"type":393,"tag":601,"props":6602,"children":6603},{"style":1054},[6604],{"type":398,"value":1057},{"type":393,"tag":601,"props":6606,"children":6607},{"style":613},[6608],{"type":398,"value":1062},{"type":393,"tag":601,"props":6610,"children":6611},{"style":667},[6612],{"type":398,"value":6613},"\"Original types:\"",{"type":393,"tag":601,"props":6615,"children":6616},{"style":613},[6617],{"type":398,"value":6618},", raw_data.dtypes.to_dict())\n",{"type":393,"tag":601,"props":6620,"children":6621},{"class":603,"line":177},[6622,6626],{"type":393,"tag":601,"props":6623,"children":6624},{"style":1054},[6625],{"type":398,"value":1057},{"type":393,"tag":601,"props":6627,"children":6628},{"style":613},[6629],{"type":398,"value":1096},{"type":393,"tag":601,"props":6631,"children":6632},{"class":603,"line":186},[6633],{"type":393,"tag":601,"props":6634,"children":6635},{"emptyLinePlaceholder":12},[6636],{"type":398,"value":634},{"type":393,"tag":601,"props":6638,"children":6639},{"class":603,"line":197},[6640,6644,6648,6653],{"type":393,"tag":601,"props":6641,"children":6642},{"style":1054},[6643],{"type":398,"value":1057},{"type":393,"tag":601,"props":6645,"children":6646},{"style":613},[6647],{"type":398,"value":1062},{"type":393,"tag":601,"props":6649,"children":6650},{"style":667},[6651],{"type":398,"value":6652},"\"🎯 Complete Type Conversion Workflow:\"",{"type":393,"tag":601,"props":6654,"children":6655},{"style":613},[6656],{"type":398,"value":1072},{"type":393,"tag":601,"props":6658,"children":6659},{"class":603,"line":206},[6660,6664],{"type":393,"tag":601,"props":6661,"children":6662},{"style":1054},[6663],{"type":398,"value":1057},{"type":393,"tag":601,"props":6665,"children":6666},{"style":613},[6667],{"type":398,"value":1096},{"type":393,"tag":601,"props":6669,"children":6670},{"class":603,"line":215},[6671],{"type":393,"tag":601,"props":6672,"children":6673},{"emptyLinePlaceholder":12},[6674],{"type":398,"value":634},{"type":393,"tag":601,"props":6676,"children":6677},{"class":603,"line":224},[6678],{"type":393,"tag":601,"props":6679,"children":6680},{"style":640},[6681],{"type":398,"value":6682},"# Step 1: Create a copy for cleaning\n",{"type":393,"tag":601,"props":6684,"children":6685},{"class":603,"line":233},[6686,6691,6695],{"type":393,"tag":601,"props":6687,"children":6688},{"style":613},[6689],{"type":398,"value":6690},"cleaned_data ",{"type":393,"tag":601,"props":6692,"children":6693},{"style":607},[6694],{"type":398,"value":656},{"type":393,"tag":601,"props":6696,"children":6697},{"style":613},[6698],{"type":398,"value":6699}," raw_data.copy()\n",{"type":393,"tag":601,"props":6701,"children":6702},{"class":603,"line":244},[6703],{"type":393,"tag":601,"props":6704,"children":6705},{"emptyLinePlaceholder":12},[6706],{"type":398,"value":634},{"type":393,"tag":601,"props":6708,"children":6709},{"class":603,"line":253},[6710],{"type":393,"tag":601,"props":6711,"children":6712},{"style":640},[6713],{"type":398,"value":6714},"# Step 2: Convert IDs to integers\n",{"type":393,"tag":601,"props":6716,"children":6717},{"class":603,"line":262},[6718,6722,6726,6731],{"type":393,"tag":601,"props":6719,"children":6720},{"style":1054},[6721],{"type":398,"value":1057},{"type":393,"tag":601,"props":6723,"children":6724},{"style":613},[6725],{"type":398,"value":1062},{"type":393,"tag":601,"props":6727,"children":6728},{"style":667},[6729],{"type":398,"value":6730},"\"1️⃣ Convert IDs to integers:\"",{"type":393,"tag":601,"props":6732,"children":6733},{"style":613},[6734],{"type":398,"value":1072},{"type":393,"tag":601,"props":6736,"children":6737},{"class":603,"line":271},[6738,6743,6748,6752,6756,6761,6765],{"type":393,"tag":601,"props":6739,"children":6740},{"style":613},[6741],{"type":398,"value":6742},"cleaned_data[",{"type":393,"tag":601,"props":6744,"children":6745},{"style":667},[6746],{"type":398,"value":6747},"'order_id'",{"type":393,"tag":601,"props":6749,"children":6750},{"style":613},[6751],{"type":398,"value":1759},{"type":393,"tag":601,"props":6753,"children":6754},{"style":607},[6755],{"type":398,"value":656},{"type":393,"tag":601,"props":6757,"children":6758},{"style":613},[6759],{"type":398,"value":6760}," pd.to_numeric(cleaned_data[",{"type":393,"tag":601,"props":6762,"children":6763},{"style":667},[6764],{"type":398,"value":6747},{"type":393,"tag":601,"props":6766,"children":6767},{"style":613},[6768],{"type":398,"value":2016},{"type":393,"tag":601,"props":6770,"children":6771},{"class":603,"line":281},[6772],{"type":393,"tag":601,"props":6773,"children":6774},{"emptyLinePlaceholder":12},[6775],{"type":398,"value":634},{"type":393,"tag":601,"props":6777,"children":6778},{"class":603,"line":290},[6779],{"type":393,"tag":601,"props":6780,"children":6781},{"style":640},[6782],{"type":398,"value":6783},"# Step 3: Convert dates\n",{"type":393,"tag":601,"props":6785,"children":6786},{"class":603,"line":299},[6787,6791,6795,6800],{"type":393,"tag":601,"props":6788,"children":6789},{"style":1054},[6790],{"type":398,"value":1057},{"type":393,"tag":601,"props":6792,"children":6793},{"style":613},[6794],{"type":398,"value":1062},{"type":393,"tag":601,"props":6796,"children":6797},{"style":667},[6798],{"type":398,"value":6799},"\"2️⃣ Convert dates:\"",{"type":393,"tag":601,"props":6801,"children":6802},{"style":613},[6803],{"type":398,"value":1072},{"type":393,"tag":601,"props":6805,"children":6806},{"class":603,"line":308},[6807,6811,6816,6820,6824,6829,6833],{"type":393,"tag":601,"props":6808,"children":6809},{"style":613},[6810],{"type":398,"value":6742},{"type":393,"tag":601,"props":6812,"children":6813},{"style":667},[6814],{"type":398,"value":6815},"'order_date'",{"type":393,"tag":601,"props":6817,"children":6818},{"style":613},[6819],{"type":398,"value":1759},{"type":393,"tag":601,"props":6821,"children":6822},{"style":607},[6823],{"type":398,"value":656},{"type":393,"tag":601,"props":6825,"children":6826},{"style":613},[6827],{"type":398,"value":6828}," pd.to_datetime(cleaned_data[",{"type":393,"tag":601,"props":6830,"children":6831},{"style":667},[6832],{"type":398,"value":6815},{"type":393,"tag":601,"props":6834,"children":6835},{"style":613},[6836],{"type":398,"value":2016},{"type":393,"tag":601,"props":6838,"children":6839},{"class":603,"line":318},[6840],{"type":393,"tag":601,"props":6841,"children":6842},{"emptyLinePlaceholder":12},[6843],{"type":398,"value":634},{"type":393,"tag":601,"props":6845,"children":6846},{"class":603,"line":327},[6847],{"type":393,"tag":601,"props":6848,"children":6849},{"style":640},[6850],{"type":398,"value":6851},"# Step 4: Convert categories\n",{"type":393,"tag":601,"props":6853,"children":6854},{"class":603,"line":336},[6855,6859,6863,6868],{"type":393,"tag":601,"props":6856,"children":6857},{"style":1054},[6858],{"type":398,"value":1057},{"type":393,"tag":601,"props":6860,"children":6861},{"style":613},[6862],{"type":398,"value":1062},{"type":393,"tag":601,"props":6864,"children":6865},{"style":667},[6866],{"type":398,"value":6867},"\"3️⃣ Convert categories:\"",{"type":393,"tag":601,"props":6869,"children":6870},{"style":613},[6871],{"type":398,"value":1072},{"type":393,"tag":601,"props":6873,"children":6874},{"class":603,"line":346},[6875,6879,6884,6888,6892,6897,6901,6905,6909],{"type":393,"tag":601,"props":6876,"children":6877},{"style":613},[6878],{"type":398,"value":6742},{"type":393,"tag":601,"props":6880,"children":6881},{"style":667},[6882],{"type":398,"value":6883},"'product_category'",{"type":393,"tag":601,"props":6885,"children":6886},{"style":613},[6887],{"type":398,"value":1759},{"type":393,"tag":601,"props":6889,"children":6890},{"style":607},[6891],{"type":398,"value":656},{"type":393,"tag":601,"props":6893,"children":6894},{"style":613},[6895],{"type":398,"value":6896}," cleaned_data[",{"type":393,"tag":601,"props":6898,"children":6899},{"style":667},[6900],{"type":398,"value":6883},{"type":393,"tag":601,"props":6902,"children":6903},{"style":613},[6904],{"type":398,"value":1777},{"type":393,"tag":601,"props":6906,"children":6907},{"style":667},[6908],{"type":398,"value":4551},{"type":393,"tag":601,"props":6910,"children":6911},{"style":613},[6912],{"type":398,"value":1072},{"type":393,"tag":601,"props":6914,"children":6915},{"class":603,"line":355},[6916],{"type":393,"tag":601,"props":6917,"children":6918},{"emptyLinePlaceholder":12},[6919],{"type":398,"value":634},{"type":393,"tag":601,"props":6921,"children":6922},{"class":603,"line":364},[6923],{"type":393,"tag":601,"props":6924,"children":6925},{"style":640},[6926],{"type":398,"value":6927},"# Step 5: Convert numeric columns\n",{"type":393,"tag":601,"props":6929,"children":6930},{"class":603,"line":374},[6931,6935,6939,6944],{"type":393,"tag":601,"props":6932,"children":6933},{"style":1054},[6934],{"type":398,"value":1057},{"type":393,"tag":601,"props":6936,"children":6937},{"style":613},[6938],{"type":398,"value":1062},{"type":393,"tag":601,"props":6940,"children":6941},{"style":667},[6942],{"type":398,"value":6943},"\"4️⃣ Convert numeric columns:\"",{"type":393,"tag":601,"props":6945,"children":6946},{"style":613},[6947],{"type":398,"value":1072},{"type":393,"tag":601,"props":6949,"children":6950},{"class":603,"line":383},[6951,6955,6959,6963,6967,6971,6975],{"type":393,"tag":601,"props":6952,"children":6953},{"style":613},[6954],{"type":398,"value":6742},{"type":393,"tag":601,"props":6956,"children":6957},{"style":667},[6958],{"type":398,"value":1839},{"type":393,"tag":601,"props":6960,"children":6961},{"style":613},[6962],{"type":398,"value":1759},{"type":393,"tag":601,"props":6964,"children":6965},{"style":607},[6966],{"type":398,"value":656},{"type":393,"tag":601,"props":6968,"children":6969},{"style":613},[6970],{"type":398,"value":6760},{"type":393,"tag":601,"props":6972,"children":6973},{"style":667},[6974],{"type":398,"value":1839},{"type":393,"tag":601,"props":6976,"children":6977},{"style":613},[6978],{"type":398,"value":2016},{"type":393,"tag":601,"props":6980,"children":6981},{"class":603,"line":3949},[6982,6986,6991,6995,6999,7003,7007],{"type":393,"tag":601,"props":6983,"children":6984},{"style":613},[6985],{"type":398,"value":6742},{"type":393,"tag":601,"props":6987,"children":6988},{"style":667},[6989],{"type":398,"value":6990},"'unit_price'",{"type":393,"tag":601,"props":6992,"children":6993},{"style":613},[6994],{"type":398,"value":1759},{"type":393,"tag":601,"props":6996,"children":6997},{"style":607},[6998],{"type":398,"value":656},{"type":393,"tag":601,"props":7000,"children":7001},{"style":613},[7002],{"type":398,"value":6760},{"type":393,"tag":601,"props":7004,"children":7005},{"style":667},[7006],{"type":398,"value":6990},{"type":393,"tag":601,"props":7008,"children":7009},{"style":613},[7010],{"type":398,"value":2016},{"type":393,"tag":601,"props":7012,"children":7013},{"class":603,"line":3961},[7014,7018,7023,7027,7031,7035,7039],{"type":393,"tag":601,"props":7015,"children":7016},{"style":613},[7017],{"type":398,"value":6742},{"type":393,"tag":601,"props":7019,"children":7020},{"style":667},[7021],{"type":398,"value":7022},"'customer_rating'",{"type":393,"tag":601,"props":7024,"children":7025},{"style":613},[7026],{"type":398,"value":1759},{"type":393,"tag":601,"props":7028,"children":7029},{"style":607},[7030],{"type":398,"value":656},{"type":393,"tag":601,"props":7032,"children":7033},{"style":613},[7034],{"type":398,"value":6760},{"type":393,"tag":601,"props":7036,"children":7037},{"style":667},[7038],{"type":398,"value":7022},{"type":393,"tag":601,"props":7040,"children":7041},{"style":613},[7042],{"type":398,"value":2016},{"type":393,"tag":601,"props":7044,"children":7045},{"class":603,"line":3969},[7046],{"type":393,"tag":601,"props":7047,"children":7048},{"emptyLinePlaceholder":12},[7049],{"type":398,"value":634},{"type":393,"tag":601,"props":7051,"children":7052},{"class":603,"line":3990},[7053],{"type":393,"tag":601,"props":7054,"children":7055},{"style":640},[7056],{"type":398,"value":7057},"# Step 6: Convert boolean\n",{"type":393,"tag":601,"props":7059,"children":7060},{"class":603,"line":4927},[7061,7065,7069,7074],{"type":393,"tag":601,"props":7062,"children":7063},{"style":1054},[7064],{"type":398,"value":1057},{"type":393,"tag":601,"props":7066,"children":7067},{"style":613},[7068],{"type":398,"value":1062},{"type":393,"tag":601,"props":7070,"children":7071},{"style":667},[7072],{"type":398,"value":7073},"\"5️⃣ Convert boolean:\"",{"type":393,"tag":601,"props":7075,"children":7076},{"style":613},[7077],{"type":398,"value":1072},{"type":393,"tag":601,"props":7079,"children":7080},{"class":603,"line":4948},[7081,7085,7090,7094,7098,7102,7106,7110,7114],{"type":393,"tag":601,"props":7082,"children":7083},{"style":613},[7084],{"type":398,"value":6742},{"type":393,"tag":601,"props":7086,"children":7087},{"style":667},[7088],{"type":398,"value":7089},"'is_express_shipping'",{"type":393,"tag":601,"props":7091,"children":7092},{"style":613},[7093],{"type":398,"value":1759},{"type":393,"tag":601,"props":7095,"children":7096},{"style":607},[7097],{"type":398,"value":656},{"type":393,"tag":601,"props":7099,"children":7100},{"style":613},[7101],{"type":398,"value":6896},{"type":393,"tag":601,"props":7103,"children":7104},{"style":667},[7105],{"type":398,"value":7089},{"type":393,"tag":601,"props":7107,"children":7108},{"style":613},[7109],{"type":398,"value":1759},{"type":393,"tag":601,"props":7111,"children":7112},{"style":607},[7113],{"type":398,"value":3657},{"type":393,"tag":601,"props":7115,"children":7116},{"style":667},[7117],{"type":398,"value":3662},{"type":393,"tag":601,"props":7119,"children":7120},{"class":603,"line":6020},[7121],{"type":393,"tag":601,"props":7122,"children":7123},{"emptyLinePlaceholder":12},[7124],{"type":398,"value":634},{"type":393,"tag":601,"props":7126,"children":7127},{"class":603,"line":6070},[7128,7132,7136,7141],{"type":393,"tag":601,"props":7129,"children":7130},{"style":1054},[7131],{"type":398,"value":1057},{"type":393,"tag":601,"props":7133,"children":7134},{"style":613},[7135],{"type":398,"value":1062},{"type":393,"tag":601,"props":7137,"children":7138},{"style":667},[7139],{"type":398,"value":7140},"\"✅ Final cleaned data:\"",{"type":393,"tag":601,"props":7142,"children":7143},{"style":613},[7144],{"type":398,"value":1072},{"type":393,"tag":601,"props":7146,"children":7148},{"class":603,"line":7147},49,[7149,7153],{"type":393,"tag":601,"props":7150,"children":7151},{"style":1054},[7152],{"type":398,"value":1057},{"type":393,"tag":601,"props":7154,"children":7155},{"style":613},[7156],{"type":398,"value":7157},"(cleaned_data)\n",{"type":393,"tag":601,"props":7159,"children":7161},{"class":603,"line":7160},50,[7162,7166],{"type":393,"tag":601,"props":7163,"children":7164},{"style":1054},[7165],{"type":398,"value":1057},{"type":393,"tag":601,"props":7167,"children":7168},{"style":613},[7169],{"type":398,"value":1096},{"type":393,"tag":601,"props":7171,"children":7173},{"class":603,"line":7172},51,[7174,7178,7182,7186],{"type":393,"tag":601,"props":7175,"children":7176},{"style":1054},[7177],{"type":398,"value":1057},{"type":393,"tag":601,"props":7179,"children":7180},{"style":613},[7181],{"type":398,"value":1062},{"type":393,"tag":601,"props":7183,"children":7184},{"style":667},[7185],{"type":398,"value":1915},{"type":393,"tag":601,"props":7187,"children":7188},{"style":613},[7189],{"type":398,"value":7190},", cleaned_data.dtypes.to_dict())\n",{"type":393,"tag":601,"props":7192,"children":7194},{"class":603,"line":7193},52,[7195,7199],{"type":393,"tag":601,"props":7196,"children":7197},{"style":1054},[7198],{"type":398,"value":1057},{"type":393,"tag":601,"props":7200,"children":7201},{"style":613},[7202],{"type":398,"value":1096},{"type":393,"tag":601,"props":7204,"children":7206},{"class":603,"line":7205},53,[7207],{"type":393,"tag":601,"props":7208,"children":7209},{"emptyLinePlaceholder":12},[7210],{"type":398,"value":634},{"type":393,"tag":601,"props":7212,"children":7214},{"class":603,"line":7213},54,[7215,7219,7223,7228],{"type":393,"tag":601,"props":7216,"children":7217},{"style":1054},[7218],{"type":398,"value":1057},{"type":393,"tag":601,"props":7220,"children":7221},{"style":613},[7222],{"type":398,"value":1062},{"type":393,"tag":601,"props":7224,"children":7225},{"style":667},[7226],{"type":398,"value":7227},"\"🎯 Now we can do proper analysis:\"",{"type":393,"tag":601,"props":7229,"children":7230},{"style":613},[7231],{"type":398,"value":1072},{"type":393,"tag":601,"props":7233,"children":7235},{"class":603,"line":7234},55,[7236,7240,7244,7249,7254,7259,7264,7268,7272,7277,7281,7285,7290,7295,7300,7305],{"type":393,"tag":601,"props":7237,"children":7238},{"style":1054},[7239],{"type":398,"value":1057},{"type":393,"tag":601,"props":7241,"children":7242},{"style":613},[7243],{"type":398,"value":1062},{"type":393,"tag":601,"props":7245,"children":7246},{"style":607},[7247],{"type":398,"value":7248},"f",{"type":393,"tag":601,"props":7250,"children":7251},{"style":667},[7252],{"type":398,"value":7253},"\"Average order value: $",{"type":393,"tag":601,"props":7255,"children":7256},{"style":1054},[7257],{"type":398,"value":7258},"{",{"type":393,"tag":601,"props":7260,"children":7261},{"style":613},[7262],{"type":398,"value":7263},"(cleaned_data[",{"type":393,"tag":601,"props":7265,"children":7266},{"style":667},[7267],{"type":398,"value":1839},{"type":393,"tag":601,"props":7269,"children":7270},{"style":613},[7271],{"type":398,"value":1759},{"type":393,"tag":601,"props":7273,"children":7274},{"style":607},[7275],{"type":398,"value":7276},"*",{"type":393,"tag":601,"props":7278,"children":7279},{"style":613},[7280],{"type":398,"value":6896},{"type":393,"tag":601,"props":7282,"children":7283},{"style":667},[7284],{"type":398,"value":6990},{"type":393,"tag":601,"props":7286,"children":7287},{"style":613},[7288],{"type":398,"value":7289},"]).mean()",{"type":393,"tag":601,"props":7291,"children":7292},{"style":607},[7293],{"type":398,"value":7294},":.2f",{"type":393,"tag":601,"props":7296,"children":7297},{"style":1054},[7298],{"type":398,"value":7299},"}",{"type":393,"tag":601,"props":7301,"children":7302},{"style":667},[7303],{"type":398,"value":7304},"\"",{"type":393,"tag":601,"props":7306,"children":7307},{"style":613},[7308],{"type":398,"value":1072},{"type":393,"tag":601,"props":7310,"children":7312},{"class":603,"line":7311},56,[7313,7317,7321,7325,7330,7334,7338,7342,7347,7352,7356,7360],{"type":393,"tag":601,"props":7314,"children":7315},{"style":1054},[7316],{"type":398,"value":1057},{"type":393,"tag":601,"props":7318,"children":7319},{"style":613},[7320],{"type":398,"value":1062},{"type":393,"tag":601,"props":7322,"children":7323},{"style":607},[7324],{"type":398,"value":7248},{"type":393,"tag":601,"props":7326,"children":7327},{"style":667},[7328],{"type":398,"value":7329},"\"Express shipping rate: ",{"type":393,"tag":601,"props":7331,"children":7332},{"style":1054},[7333],{"type":398,"value":7258},{"type":393,"tag":601,"props":7335,"children":7336},{"style":613},[7337],{"type":398,"value":6742},{"type":393,"tag":601,"props":7339,"children":7340},{"style":667},[7341],{"type":398,"value":7089},{"type":393,"tag":601,"props":7343,"children":7344},{"style":613},[7345],{"type":398,"value":7346},"].mean()",{"type":393,"tag":601,"props":7348,"children":7349},{"style":607},[7350],{"type":398,"value":7351},":.1%",{"type":393,"tag":601,"props":7353,"children":7354},{"style":1054},[7355],{"type":398,"value":7299},{"type":393,"tag":601,"props":7357,"children":7358},{"style":667},[7359],{"type":398,"value":7304},{"type":393,"tag":601,"props":7361,"children":7362},{"style":613},[7363],{"type":398,"value":1072},{"type":393,"tag":601,"props":7365,"children":7367},{"class":603,"line":7366},57,[7368,7372,7376,7380,7385,7389,7393,7397,7401,7406,7410,7415],{"type":393,"tag":601,"props":7369,"children":7370},{"style":1054},[7371],{"type":398,"value":1057},{"type":393,"tag":601,"props":7373,"children":7374},{"style":613},[7375],{"type":398,"value":1062},{"type":393,"tag":601,"props":7377,"children":7378},{"style":607},[7379],{"type":398,"value":7248},{"type":393,"tag":601,"props":7381,"children":7382},{"style":667},[7383],{"type":398,"value":7384},"\"Average rating: ",{"type":393,"tag":601,"props":7386,"children":7387},{"style":1054},[7388],{"type":398,"value":7258},{"type":393,"tag":601,"props":7390,"children":7391},{"style":613},[7392],{"type":398,"value":6742},{"type":393,"tag":601,"props":7394,"children":7395},{"style":667},[7396],{"type":398,"value":7022},{"type":393,"tag":601,"props":7398,"children":7399},{"style":613},[7400],{"type":398,"value":7346},{"type":393,"tag":601,"props":7402,"children":7403},{"style":607},[7404],{"type":398,"value":7405},":.1f",{"type":393,"tag":601,"props":7407,"children":7408},{"style":1054},[7409],{"type":398,"value":7299},{"type":393,"tag":601,"props":7411,"children":7412},{"style":667},[7413],{"type":398,"value":7414},"/5\"",{"type":393,"tag":601,"props":7416,"children":7417},{"style":613},[7418],{"type":398,"value":1072},{"type":393,"tag":575,"props":7420,"children":7422},{"id":7421},"️-type-conversion-pitfalls",[7423],{"type":398,"value":7424},"⚠️ Type Conversion Pitfalls",{"type":393,"tag":401,"props":7426,"children":7427},{},[7428],{"type":398,"value":7429},"Handle messy real-world data safely to avoid conversion errors:",{"type":393,"tag":407,"props":7431,"children":7435},{"emoji":7432,"title":7433,"type":7434},"⚠️","Type Conversion Mistakes","warning",[7436,7444,7452,7491,7499,7521,7529,7574,7582,7604],{"type":393,"tag":401,"props":7437,"children":7438},{},[7439],{"type":393,"tag":417,"props":7440,"children":7441},{},[7442],{"type":398,"value":7443},"Critical Mistakes to Avoid:",{"type":393,"tag":401,"props":7445,"children":7446},{},[7447],{"type":393,"tag":417,"props":7448,"children":7449},{},[7450],{"type":398,"value":7451},"1. Not Handling Conversion Errors",{"type":393,"tag":431,"props":7453,"children":7454},{},[7455,7468,7478],{"type":393,"tag":435,"props":7456,"children":7457},{},[7458,7460,7466],{"type":398,"value":7459},"❌ Wrong: Using ",{"type":393,"tag":441,"props":7461,"children":7463},{"className":7462},[],[7464],{"type":398,"value":7465},".astype()",{"type":398,"value":7467}," on messy data without error handling",{"type":393,"tag":435,"props":7469,"children":7470},{},[7471,7476],{"type":393,"tag":417,"props":7472,"children":7473},{},[7474],{"type":398,"value":7475},"Problem:",{"type":398,"value":7477}," Crashes when encountering 'N/A', invalid dates, etc.",{"type":393,"tag":435,"props":7479,"children":7480},{},[7481,7483,7489],{"type":398,"value":7482},"✅ Better: Use ",{"type":393,"tag":441,"props":7484,"children":7486},{"className":7485},[],[7487],{"type":398,"value":7488},"errors='coerce'",{"type":398,"value":7490}," to convert bad values to NaN",{"type":393,"tag":401,"props":7492,"children":7493},{},[7494],{"type":393,"tag":417,"props":7495,"children":7496},{},[7497],{"type":398,"value":7498},"2. Ignoring Invalid Data",{"type":393,"tag":431,"props":7500,"children":7501},{},[7502,7507,7516],{"type":393,"tag":435,"props":7503,"children":7504},{},[7505],{"type":398,"value":7506},"❌ Wrong: Not checking what failed to convert",{"type":393,"tag":435,"props":7508,"children":7509},{},[7510,7514],{"type":393,"tag":417,"props":7511,"children":7512},{},[7513],{"type":398,"value":7475},{"type":398,"value":7515}," Silent data loss or incorrect assumptions",{"type":393,"tag":435,"props":7517,"children":7518},{},[7519],{"type":398,"value":7520},"✅ Better: Examine NaN values after conversion to understand failures",{"type":393,"tag":401,"props":7522,"children":7523},{},[7524],{"type":393,"tag":417,"props":7525,"children":7526},{},[7527],{"type":398,"value":7528},"3. Wrong Method Choice",{"type":393,"tag":431,"props":7530,"children":7531},{},[7532,7543,7562],{"type":393,"tag":435,"props":7533,"children":7534},{},[7535,7536,7541],{"type":398,"value":7459},{"type":393,"tag":441,"props":7537,"children":7539},{"className":7538},[],[7540],{"type":398,"value":7465},{"type":398,"value":7542}," for dirty data",{"type":393,"tag":435,"props":7544,"children":7545},{},[7546,7547,7553,7555,7560],{"type":398,"value":7459},{"type":393,"tag":441,"props":7548,"children":7550},{"className":7549},[],[7551],{"type":398,"value":7552},"pd.to_numeric()",{"type":398,"value":7554}," without ",{"type":393,"tag":441,"props":7556,"children":7558},{"className":7557},[],[7559],{"type":398,"value":5695},{"type":398,"value":7561}," parameter",{"type":393,"tag":435,"props":7563,"children":7564},{},[7565,7566,7572],{"type":398,"value":7482},{"type":393,"tag":441,"props":7567,"children":7569},{"className":7568},[],[7570],{"type":398,"value":7571},"pd.to_numeric(errors='coerce')",{"type":398,"value":7573}," for safety",{"type":393,"tag":401,"props":7575,"children":7576},{},[7577],{"type":393,"tag":417,"props":7578,"children":7579},{},[7580],{"type":398,"value":7581},"4. Not Validating Results",{"type":393,"tag":431,"props":7583,"children":7584},{},[7585,7590,7599],{"type":393,"tag":435,"props":7586,"children":7587},{},[7588],{"type":398,"value":7589},"❌ Wrong: Assuming conversion worked correctly",{"type":393,"tag":435,"props":7591,"children":7592},{},[7593,7597],{"type":393,"tag":417,"props":7594,"children":7595},{},[7596],{"type":398,"value":7475},{"type":398,"value":7598}," Incorrect data types lead to analysis errors",{"type":393,"tag":435,"props":7600,"children":7601},{},[7602],{"type":398,"value":7603},"✅ Better: Always check data types and value ranges after conversion",{"type":393,"tag":401,"props":7605,"children":7606},{},[7607,7612],{"type":393,"tag":417,"props":7608,"children":7609},{},[7610],{"type":398,"value":7611},"Safe Conversion Pattern:",{"type":398,"value":7613}," Clean data → Use appropriate method → Handle errors → Validate results",{"type":393,"tag":587,"props":7615,"children":7616},{},[7617],{"type":393,"tag":591,"props":7618,"children":7620},{"className":593,"code":7619,"language":595,"meta":6,"style":6},"import pandas as pd\n\n# Data demonstrating safe conversion practices\nproblematic_data = pd.DataFrame({\n    'mixed_numbers': ['100', '200.5', 'N/A', '300'],\n    'dates_with_errors': ['2023-01-15', '2023-02-30', '2023-03-15', 'invalid'],\n    'yes_no_maybe': ['Yes', 'No', 'Maybe', 'Yes']\n})\n\nprint(\"📊 Problematic Data:\")\nprint(problematic_data)\nprint()\n\nprint(\"✅ Safe Conversion Approach:\")\nprint()\n\n# Safe numeric conversion\nsafe_numbers = pd.to_numeric(problematic_data['mixed_numbers'], errors='coerce')\nprint(\"Safe numeric conversion:\")\nprint(safe_numbers)\nprint(f\"Failed conversions: {safe_numbers.isnull().sum()}\")\nprint()\n\n# Safe date conversion\nsafe_dates = pd.to_datetime(problematic_data['dates_with_errors'], errors='coerce')\nprint(\"Safe date conversion:\")\nprint(safe_dates)\nprint(f\"Failed conversions: {safe_dates.isnull().sum()}\")\nprint()\n\nprint(\"🎯 Always validate your conversion results!\")\n",[7621],{"type":393,"tag":441,"props":7622,"children":7623},{"__ignoreMap":6},[7624,7643,7650,7658,7674,7721,7767,7812,7819,7826,7846,7858,7869,7876,7896,7907,7914,7922,7965,7985,7997,8038,8049,8056,8064,8106,8126,8138,8178,8189,8196],{"type":393,"tag":601,"props":7625,"children":7626},{"class":603,"line":11},[7627,7631,7635,7639],{"type":393,"tag":601,"props":7628,"children":7629},{"style":607},[7630],{"type":398,"value":610},{"type":393,"tag":601,"props":7632,"children":7633},{"style":613},[7634],{"type":398,"value":616},{"type":393,"tag":601,"props":7636,"children":7637},{"style":607},[7638],{"type":398,"value":621},{"type":393,"tag":601,"props":7640,"children":7641},{"style":613},[7642],{"type":398,"value":626},{"type":393,"tag":601,"props":7644,"children":7645},{"class":603,"line":27},[7646],{"type":393,"tag":601,"props":7647,"children":7648},{"emptyLinePlaceholder":12},[7649],{"type":398,"value":634},{"type":393,"tag":601,"props":7651,"children":7652},{"class":603,"line":36},[7653],{"type":393,"tag":601,"props":7654,"children":7655},{"style":640},[7656],{"type":398,"value":7657},"# Data demonstrating safe conversion practices\n",{"type":393,"tag":601,"props":7659,"children":7660},{"class":603,"line":45},[7661,7666,7670],{"type":393,"tag":601,"props":7662,"children":7663},{"style":613},[7664],{"type":398,"value":7665},"problematic_data ",{"type":393,"tag":601,"props":7667,"children":7668},{"style":607},[7669],{"type":398,"value":656},{"type":393,"tag":601,"props":7671,"children":7672},{"style":613},[7673],{"type":398,"value":661},{"type":393,"tag":601,"props":7675,"children":7676},{"class":603,"line":54},[7677,7682,7686,7691,7695,7700,7704,7708,7712,7717],{"type":393,"tag":601,"props":7678,"children":7679},{"style":667},[7680],{"type":398,"value":7681},"    'mixed_numbers'",{"type":393,"tag":601,"props":7683,"children":7684},{"style":613},[7685],{"type":398,"value":675},{"type":393,"tag":601,"props":7687,"children":7688},{"style":667},[7689],{"type":398,"value":7690},"'100'",{"type":393,"tag":601,"props":7692,"children":7693},{"style":613},[7694],{"type":398,"value":685},{"type":393,"tag":601,"props":7696,"children":7697},{"style":667},[7698],{"type":398,"value":7699},"'200.5'",{"type":393,"tag":601,"props":7701,"children":7702},{"style":613},[7703],{"type":398,"value":685},{"type":393,"tag":601,"props":7705,"children":7706},{"style":667},[7707],{"type":398,"value":5145},{"type":393,"tag":601,"props":7709,"children":7710},{"style":613},[7711],{"type":398,"value":685},{"type":393,"tag":601,"props":7713,"children":7714},{"style":667},[7715],{"type":398,"value":7716},"'300'",{"type":393,"tag":601,"props":7718,"children":7719},{"style":613},[7720],{"type":398,"value":1432},{"type":393,"tag":601,"props":7722,"children":7723},{"class":603,"line":63},[7724,7729,7733,7737,7741,7746,7750,7754,7758,7763],{"type":393,"tag":601,"props":7725,"children":7726},{"style":667},[7727],{"type":398,"value":7728},"    'dates_with_errors'",{"type":393,"tag":601,"props":7730,"children":7731},{"style":613},[7732],{"type":398,"value":675},{"type":393,"tag":601,"props":7734,"children":7735},{"style":667},[7736],{"type":398,"value":867},{"type":393,"tag":601,"props":7738,"children":7739},{"style":613},[7740],{"type":398,"value":685},{"type":393,"tag":601,"props":7742,"children":7743},{"style":667},[7744],{"type":398,"value":7745},"'2023-02-30'",{"type":393,"tag":601,"props":7747,"children":7748},{"style":613},[7749],{"type":398,"value":685},{"type":393,"tag":601,"props":7751,"children":7752},{"style":667},[7753],{"type":398,"value":2294},{"type":393,"tag":601,"props":7755,"children":7756},{"style":613},[7757],{"type":398,"value":685},{"type":393,"tag":601,"props":7759,"children":7760},{"style":667},[7761],{"type":398,"value":7762},"'invalid'",{"type":393,"tag":601,"props":7764,"children":7765},{"style":613},[7766],{"type":398,"value":1432},{"type":393,"tag":601,"props":7768,"children":7769},{"class":603,"line":72},[7770,7775,7779,7783,7787,7791,7795,7800,7804,7808],{"type":393,"tag":601,"props":7771,"children":7772},{"style":667},[7773],{"type":398,"value":7774},"    'yes_no_maybe'",{"type":393,"tag":601,"props":7776,"children":7777},{"style":613},[7778],{"type":398,"value":675},{"type":393,"tag":601,"props":7780,"children":7781},{"style":667},[7782],{"type":398,"value":3153},{"type":393,"tag":601,"props":7784,"children":7785},{"style":613},[7786],{"type":398,"value":685},{"type":393,"tag":601,"props":7788,"children":7789},{"style":667},[7790],{"type":398,"value":3162},{"type":393,"tag":601,"props":7792,"children":7793},{"style":613},[7794],{"type":398,"value":685},{"type":393,"tag":601,"props":7796,"children":7797},{"style":667},[7798],{"type":398,"value":7799},"'Maybe'",{"type":393,"tag":601,"props":7801,"children":7802},{"style":613},[7803],{"type":398,"value":685},{"type":393,"tag":601,"props":7805,"children":7806},{"style":667},[7807],{"type":398,"value":3153},{"type":393,"tag":601,"props":7809,"children":7810},{"style":613},[7811],{"type":398,"value":1573},{"type":393,"tag":601,"props":7813,"children":7814},{"class":603,"line":83},[7815],{"type":393,"tag":601,"props":7816,"children":7817},{"style":613},[7818],{"type":398,"value":1041},{"type":393,"tag":601,"props":7820,"children":7821},{"class":603,"line":92},[7822],{"type":393,"tag":601,"props":7823,"children":7824},{"emptyLinePlaceholder":12},[7825],{"type":398,"value":634},{"type":393,"tag":601,"props":7827,"children":7828},{"class":603,"line":101},[7829,7833,7837,7842],{"type":393,"tag":601,"props":7830,"children":7831},{"style":1054},[7832],{"type":398,"value":1057},{"type":393,"tag":601,"props":7834,"children":7835},{"style":613},[7836],{"type":398,"value":1062},{"type":393,"tag":601,"props":7838,"children":7839},{"style":667},[7840],{"type":398,"value":7841},"\"📊 Problematic Data:\"",{"type":393,"tag":601,"props":7843,"children":7844},{"style":613},[7845],{"type":398,"value":1072},{"type":393,"tag":601,"props":7847,"children":7848},{"class":603,"line":110},[7849,7853],{"type":393,"tag":601,"props":7850,"children":7851},{"style":1054},[7852],{"type":398,"value":1057},{"type":393,"tag":601,"props":7854,"children":7855},{"style":613},[7856],{"type":398,"value":7857},"(problematic_data)\n",{"type":393,"tag":601,"props":7859,"children":7860},{"class":603,"line":121},[7861,7865],{"type":393,"tag":601,"props":7862,"children":7863},{"style":1054},[7864],{"type":398,"value":1057},{"type":393,"tag":601,"props":7866,"children":7867},{"style":613},[7868],{"type":398,"value":1096},{"type":393,"tag":601,"props":7870,"children":7871},{"class":603,"line":130},[7872],{"type":393,"tag":601,"props":7873,"children":7874},{"emptyLinePlaceholder":12},[7875],{"type":398,"value":634},{"type":393,"tag":601,"props":7877,"children":7878},{"class":603,"line":139},[7879,7883,7887,7892],{"type":393,"tag":601,"props":7880,"children":7881},{"style":1054},[7882],{"type":398,"value":1057},{"type":393,"tag":601,"props":7884,"children":7885},{"style":613},[7886],{"type":398,"value":1062},{"type":393,"tag":601,"props":7888,"children":7889},{"style":667},[7890],{"type":398,"value":7891},"\"✅ Safe Conversion Approach:\"",{"type":393,"tag":601,"props":7893,"children":7894},{"style":613},[7895],{"type":398,"value":1072},{"type":393,"tag":601,"props":7897,"children":7898},{"class":603,"line":148},[7899,7903],{"type":393,"tag":601,"props":7900,"children":7901},{"style":1054},[7902],{"type":398,"value":1057},{"type":393,"tag":601,"props":7904,"children":7905},{"style":613},[7906],{"type":398,"value":1096},{"type":393,"tag":601,"props":7908,"children":7909},{"class":603,"line":159},[7910],{"type":393,"tag":601,"props":7911,"children":7912},{"emptyLinePlaceholder":12},[7913],{"type":398,"value":634},{"type":393,"tag":601,"props":7915,"children":7916},{"class":603,"line":168},[7917],{"type":393,"tag":601,"props":7918,"children":7919},{"style":640},[7920],{"type":398,"value":7921},"# Safe numeric conversion\n",{"type":393,"tag":601,"props":7923,"children":7924},{"class":603,"line":177},[7925,7930,7934,7939,7944,7948,7952,7956,7961],{"type":393,"tag":601,"props":7926,"children":7927},{"style":613},[7928],{"type":398,"value":7929},"safe_numbers ",{"type":393,"tag":601,"props":7931,"children":7932},{"style":607},[7933],{"type":398,"value":656},{"type":393,"tag":601,"props":7935,"children":7936},{"style":613},[7937],{"type":398,"value":7938}," pd.to_numeric(problematic_data[",{"type":393,"tag":601,"props":7940,"children":7941},{"style":667},[7942],{"type":398,"value":7943},"'mixed_numbers'",{"type":393,"tag":601,"props":7945,"children":7946},{"style":613},[7947],{"type":398,"value":5690},{"type":393,"tag":601,"props":7949,"children":7950},{"style":4420},[7951],{"type":398,"value":5695},{"type":393,"tag":601,"props":7953,"children":7954},{"style":607},[7955],{"type":398,"value":656},{"type":393,"tag":601,"props":7957,"children":7958},{"style":667},[7959],{"type":398,"value":7960},"'coerce'",{"type":393,"tag":601,"props":7962,"children":7963},{"style":613},[7964],{"type":398,"value":1072},{"type":393,"tag":601,"props":7966,"children":7967},{"class":603,"line":186},[7968,7972,7976,7981],{"type":393,"tag":601,"props":7969,"children":7970},{"style":1054},[7971],{"type":398,"value":1057},{"type":393,"tag":601,"props":7973,"children":7974},{"style":613},[7975],{"type":398,"value":1062},{"type":393,"tag":601,"props":7977,"children":7978},{"style":667},[7979],{"type":398,"value":7980},"\"Safe numeric conversion:\"",{"type":393,"tag":601,"props":7982,"children":7983},{"style":613},[7984],{"type":398,"value":1072},{"type":393,"tag":601,"props":7986,"children":7987},{"class":603,"line":197},[7988,7992],{"type":393,"tag":601,"props":7989,"children":7990},{"style":1054},[7991],{"type":398,"value":1057},{"type":393,"tag":601,"props":7993,"children":7994},{"style":613},[7995],{"type":398,"value":7996},"(safe_numbers)\n",{"type":393,"tag":601,"props":7998,"children":7999},{"class":603,"line":206},[8000,8004,8008,8012,8017,8021,8026,8030,8034],{"type":393,"tag":601,"props":8001,"children":8002},{"style":1054},[8003],{"type":398,"value":1057},{"type":393,"tag":601,"props":8005,"children":8006},{"style":613},[8007],{"type":398,"value":1062},{"type":393,"tag":601,"props":8009,"children":8010},{"style":607},[8011],{"type":398,"value":7248},{"type":393,"tag":601,"props":8013,"children":8014},{"style":667},[8015],{"type":398,"value":8016},"\"Failed conversions: ",{"type":393,"tag":601,"props":8018,"children":8019},{"style":1054},[8020],{"type":398,"value":7258},{"type":393,"tag":601,"props":8022,"children":8023},{"style":613},[8024],{"type":398,"value":8025},"safe_numbers.isnull().sum()",{"type":393,"tag":601,"props":8027,"children":8028},{"style":1054},[8029],{"type":398,"value":7299},{"type":393,"tag":601,"props":8031,"children":8032},{"style":667},[8033],{"type":398,"value":7304},{"type":393,"tag":601,"props":8035,"children":8036},{"style":613},[8037],{"type":398,"value":1072},{"type":393,"tag":601,"props":8039,"children":8040},{"class":603,"line":215},[8041,8045],{"type":393,"tag":601,"props":8042,"children":8043},{"style":1054},[8044],{"type":398,"value":1057},{"type":393,"tag":601,"props":8046,"children":8047},{"style":613},[8048],{"type":398,"value":1096},{"type":393,"tag":601,"props":8050,"children":8051},{"class":603,"line":224},[8052],{"type":393,"tag":601,"props":8053,"children":8054},{"emptyLinePlaceholder":12},[8055],{"type":398,"value":634},{"type":393,"tag":601,"props":8057,"children":8058},{"class":603,"line":233},[8059],{"type":393,"tag":601,"props":8060,"children":8061},{"style":640},[8062],{"type":398,"value":8063},"# Safe date conversion\n",{"type":393,"tag":601,"props":8065,"children":8066},{"class":603,"line":244},[8067,8072,8076,8081,8086,8090,8094,8098,8102],{"type":393,"tag":601,"props":8068,"children":8069},{"style":613},[8070],{"type":398,"value":8071},"safe_dates ",{"type":393,"tag":601,"props":8073,"children":8074},{"style":607},[8075],{"type":398,"value":656},{"type":393,"tag":601,"props":8077,"children":8078},{"style":613},[8079],{"type":398,"value":8080}," pd.to_datetime(problematic_data[",{"type":393,"tag":601,"props":8082,"children":8083},{"style":667},[8084],{"type":398,"value":8085},"'dates_with_errors'",{"type":393,"tag":601,"props":8087,"children":8088},{"style":613},[8089],{"type":398,"value":5690},{"type":393,"tag":601,"props":8091,"children":8092},{"style":4420},[8093],{"type":398,"value":5695},{"type":393,"tag":601,"props":8095,"children":8096},{"style":607},[8097],{"type":398,"value":656},{"type":393,"tag":601,"props":8099,"children":8100},{"style":667},[8101],{"type":398,"value":7960},{"type":393,"tag":601,"props":8103,"children":8104},{"style":613},[8105],{"type":398,"value":1072},{"type":393,"tag":601,"props":8107,"children":8108},{"class":603,"line":253},[8109,8113,8117,8122],{"type":393,"tag":601,"props":8110,"children":8111},{"style":1054},[8112],{"type":398,"value":1057},{"type":393,"tag":601,"props":8114,"children":8115},{"style":613},[8116],{"type":398,"value":1062},{"type":393,"tag":601,"props":8118,"children":8119},{"style":667},[8120],{"type":398,"value":8121},"\"Safe date conversion:\"",{"type":393,"tag":601,"props":8123,"children":8124},{"style":613},[8125],{"type":398,"value":1072},{"type":393,"tag":601,"props":8127,"children":8128},{"class":603,"line":262},[8129,8133],{"type":393,"tag":601,"props":8130,"children":8131},{"style":1054},[8132],{"type":398,"value":1057},{"type":393,"tag":601,"props":8134,"children":8135},{"style":613},[8136],{"type":398,"value":8137},"(safe_dates)\n",{"type":393,"tag":601,"props":8139,"children":8140},{"class":603,"line":271},[8141,8145,8149,8153,8157,8161,8166,8170,8174],{"type":393,"tag":601,"props":8142,"children":8143},{"style":1054},[8144],{"type":398,"value":1057},{"type":393,"tag":601,"props":8146,"children":8147},{"style":613},[8148],{"type":398,"value":1062},{"type":393,"tag":601,"props":8150,"children":8151},{"style":607},[8152],{"type":398,"value":7248},{"type":393,"tag":601,"props":8154,"children":8155},{"style":667},[8156],{"type":398,"value":8016},{"type":393,"tag":601,"props":8158,"children":8159},{"style":1054},[8160],{"type":398,"value":7258},{"type":393,"tag":601,"props":8162,"children":8163},{"style":613},[8164],{"type":398,"value":8165},"safe_dates.isnull().sum()",{"type":393,"tag":601,"props":8167,"children":8168},{"style":1054},[8169],{"type":398,"value":7299},{"type":393,"tag":601,"props":8171,"children":8172},{"style":667},[8173],{"type":398,"value":7304},{"type":393,"tag":601,"props":8175,"children":8176},{"style":613},[8177],{"type":398,"value":1072},{"type":393,"tag":601,"props":8179,"children":8180},{"class":603,"line":281},[8181,8185],{"type":393,"tag":601,"props":8182,"children":8183},{"style":1054},[8184],{"type":398,"value":1057},{"type":393,"tag":601,"props":8186,"children":8187},{"style":613},[8188],{"type":398,"value":1096},{"type":393,"tag":601,"props":8190,"children":8191},{"class":603,"line":290},[8192],{"type":393,"tag":601,"props":8193,"children":8194},{"emptyLinePlaceholder":12},[8195],{"type":398,"value":634},{"type":393,"tag":601,"props":8197,"children":8198},{"class":603,"line":299},[8199,8203,8207,8212],{"type":393,"tag":601,"props":8200,"children":8201},{"style":1054},[8202],{"type":398,"value":1057},{"type":393,"tag":601,"props":8204,"children":8205},{"style":613},[8206],{"type":398,"value":1062},{"type":393,"tag":601,"props":8208,"children":8209},{"style":667},[8210],{"type":398,"value":8211},"\"🎯 Always validate your conversion results!\"",{"type":393,"tag":601,"props":8213,"children":8214},{"style":613},[8215],{"type":398,"value":1072},{"type":393,"tag":575,"props":8217,"children":8219},{"id":8218},"key-takeaways",[8220],{"type":398,"value":8221},"🎯 Key Takeaways",{"type":393,"tag":407,"props":8223,"children":8226},{"emoji":409,"title":8224,"type":8225},"Data Type Conversion Mastery","success",[8227,8235,8307,8315,8345,8353,8420,8428,8462,8470,8499],{"type":393,"tag":401,"props":8228,"children":8229},{},[8230],{"type":393,"tag":417,"props":8231,"children":8232},{},[8233],{"type":398,"value":8234},"Essential Conversions:",{"type":393,"tag":431,"props":8236,"children":8237},{},[8238,8260,8275,8292],{"type":393,"tag":435,"props":8239,"children":8240},{},[8241,8246,8247,8252,8254],{"type":393,"tag":417,"props":8242,"children":8243},{},[8244],{"type":398,"value":8245},"Numbers",{"type":398,"value":3517},{"type":393,"tag":441,"props":8248,"children":8250},{"className":8249},[],[8251],{"type":398,"value":7552},{"type":398,"value":8253}," or ",{"type":393,"tag":441,"props":8255,"children":8257},{"className":8256},[],[8258],{"type":398,"value":8259},".astype('int'/'float')",{"type":393,"tag":435,"props":8261,"children":8262},{},[8263,8268,8269],{"type":393,"tag":417,"props":8264,"children":8265},{},[8266],{"type":398,"value":8267},"Dates",{"type":398,"value":3517},{"type":393,"tag":441,"props":8270,"children":8272},{"className":8271},[],[8273],{"type":398,"value":8274},"pd.to_datetime()",{"type":393,"tag":435,"props":8276,"children":8277},{},[8278,8283,8284,8290],{"type":393,"tag":417,"props":8279,"children":8280},{},[8281],{"type":398,"value":8282},"Booleans",{"type":398,"value":3517},{"type":393,"tag":441,"props":8285,"children":8287},{"className":8286},[],[8288],{"type":398,"value":8289},".astype('bool')",{"type":398,"value":8291}," or custom mapping",{"type":393,"tag":435,"props":8293,"children":8294},{},[8295,8300,8301],{"type":393,"tag":417,"props":8296,"children":8297},{},[8298],{"type":398,"value":8299},"Categories",{"type":398,"value":3517},{"type":393,"tag":441,"props":8302,"children":8304},{"className":8303},[],[8305],{"type":398,"value":8306},".astype('category')",{"type":393,"tag":401,"props":8308,"children":8309},{},[8310],{"type":393,"tag":417,"props":8311,"children":8312},{},[8313],{"type":398,"value":8314},"Safe Conversion Practices:",{"type":393,"tag":431,"props":8316,"children":8317},{},[8318,8330,8335,8340],{"type":393,"tag":435,"props":8319,"children":8320},{},[8321,8323,8328],{"type":398,"value":8322},"Use ",{"type":393,"tag":441,"props":8324,"children":8326},{"className":8325},[],[8327],{"type":398,"value":7488},{"type":398,"value":8329}," for messy real-world data",{"type":393,"tag":435,"props":8331,"children":8332},{},[8333],{"type":398,"value":8334},"Clean text first (remove $, %, extra spaces)",{"type":393,"tag":435,"props":8336,"children":8337},{},[8338],{"type":398,"value":8339},"Handle special values ('N/A', 'missing', etc.)",{"type":393,"tag":435,"props":8341,"children":8342},{},[8343],{"type":398,"value":8344},"Always validate conversion results",{"type":393,"tag":401,"props":8346,"children":8347},{},[8348],{"type":393,"tag":417,"props":8349,"children":8350},{},[8351],{"type":398,"value":8352},"Conversion Workflow:",{"type":393,"tag":8354,"props":8355,"children":8356},"ol",{},[8357,8380,8390,8400,8410],{"type":393,"tag":435,"props":8358,"children":8359},{},[8360,8365,8366,8372,8374],{"type":393,"tag":417,"props":8361,"children":8362},{},[8363],{"type":398,"value":8364},"Examine current types",{"type":398,"value":3517},{"type":393,"tag":441,"props":8367,"children":8369},{"className":8368},[],[8370],{"type":398,"value":8371},".dtypes",{"type":398,"value":8373}," and ",{"type":393,"tag":441,"props":8375,"children":8377},{"className":8376},[],[8378],{"type":398,"value":8379},".info()",{"type":393,"tag":435,"props":8381,"children":8382},{},[8383,8388],{"type":393,"tag":417,"props":8384,"children":8385},{},[8386],{"type":398,"value":8387},"Identify what each column should be",{"type":398,"value":8389},": Numbers, dates, categories, booleans",{"type":393,"tag":435,"props":8391,"children":8392},{},[8393,8398],{"type":393,"tag":417,"props":8394,"children":8395},{},[8396],{"type":398,"value":8397},"Clean problematic values",{"type":398,"value":8399},": Remove symbols, standardize text",{"type":393,"tag":435,"props":8401,"children":8402},{},[8403,8408],{"type":393,"tag":417,"props":8404,"children":8405},{},[8406],{"type":398,"value":8407},"Convert systematically",{"type":398,"value":8409},": One column at a time",{"type":393,"tag":435,"props":8411,"children":8412},{},[8413,8418],{"type":393,"tag":417,"props":8414,"children":8415},{},[8416],{"type":398,"value":8417},"Validate results",{"type":398,"value":8419},": Check for NaN values, verify calculations work",{"type":393,"tag":401,"props":8421,"children":8422},{},[8423],{"type":393,"tag":417,"props":8424,"children":8425},{},[8426],{"type":398,"value":8427},"Memory Optimization:",{"type":393,"tag":431,"props":8429,"children":8430},{},[8431,8436,8457],{"type":393,"tag":435,"props":8432,"children":8433},{},[8434],{"type":398,"value":8435},"Use categories for repetitive text data",{"type":393,"tag":435,"props":8437,"children":8438},{},[8439,8441,8447,8449,8455],{"type":398,"value":8440},"Choose appropriate numeric types (",{"type":393,"tag":441,"props":8442,"children":8444},{"className":8443},[],[8445],{"type":398,"value":8446},"int32",{"type":398,"value":8448}," vs ",{"type":393,"tag":441,"props":8450,"children":8452},{"className":8451},[],[8453],{"type":398,"value":8454},"int64",{"type":398,"value":8456},")",{"type":393,"tag":435,"props":8458,"children":8459},{},[8460],{"type":398,"value":8461},"Convert boolean text to actual boolean type",{"type":393,"tag":401,"props":8463,"children":8464},{},[8465],{"type":393,"tag":417,"props":8466,"children":8467},{},[8468],{"type":398,"value":8469},"Error Handling:",{"type":393,"tag":431,"props":8471,"children":8472},{},[8473,8483,8494],{"type":393,"tag":435,"props":8474,"children":8475},{},[8476,8481],{"type":393,"tag":441,"props":8477,"children":8479},{"className":8478},[],[8480],{"type":398,"value":7488},{"type":398,"value":8482}," converts bad values to NaN",{"type":393,"tag":435,"props":8484,"children":8485},{},[8486,8492],{"type":393,"tag":441,"props":8487,"children":8489},{"className":8488},[],[8490],{"type":398,"value":8491},"errors='ignore'",{"type":398,"value":8493}," keeps original values when conversion fails",{"type":393,"tag":435,"props":8495,"children":8496},{},[8497],{"type":398,"value":8498},"Clean data before conversion when possible",{"type":393,"tag":401,"props":8500,"children":8501},{},[8502,8507],{"type":393,"tag":417,"props":8503,"children":8504},{},[8505],{"type":398,"value":8506},"Remember:",{"type":398,"value":8508}," Proper data types enable accurate analysis and prevent calculation errors!",{"type":393,"tag":575,"props":8510,"children":8512},{"id":8511},"practice-challenge",[8513],{"type":398,"value":8514},"🎮 Practice Challenge",{"type":393,"tag":401,"props":8516,"children":8517},{},[8518],{"type":398,"value":8519},"Apply type conversion to a realistic business dataset:",{"type":393,"tag":587,"props":8521,"children":8522},{},[8523],{"type":393,"tag":591,"props":8524,"children":8526},{"className":593,"code":8525,"language":595,"meta":6,"style":6},"import pandas as pd\n\n# Customer analytics data export (typical format from many systems)\nanalytics_export = pd.DataFrame({\n    'user_id': ['10001', '10002', '10003', '10004', '10005'],\n    'signup_date': ['2023-01-15', '2023-02-10', '2023-01-25', '2023-03-05', '2023-02-20'],\n    'subscription_type': ['Premium', 'Basic', 'Premium', 'Basic', 'Premium'],\n    'monthly_revenue': ['29.99', '9.99', '29.99', '9.99', '29.99'],\n    'is_active': ['1', '1', '0', '1', '1'],\n    'last_login_days_ago': ['3', '15', '45', '7', '1'],\n    'total_sessions': ['125', '45', '8', '67', '189'],\n    'conversion_rate': ['15.5%', '8.2%', '3.1%', '12.8%', '18.9%']\n})\n\nprint(\"🎮 Analytics Export Challenge:\")\nprint(analytics_export)\nprint()\nprint(\"Mission: Convert all columns to appropriate types for analysis\")\nprint()\n\n# Solution\nprint(\"🔄 Conversion Solution:\")\ncleaned_analytics = analytics_export.copy()\n\nprint(\"Converting each column...\")\n# User ID to integer\ncleaned_analytics['user_id'] = pd.to_numeric(cleaned_analytics['user_id'])\n\n# Signup date to datetime\ncleaned_analytics['signup_date'] = pd.to_datetime(cleaned_analytics['signup_date'])\n\n# Subscription type to category\ncleaned_analytics['subscription_type'] = cleaned_analytics['subscription_type'].astype('category')\n\n# Revenue to float\ncleaned_analytics['monthly_revenue'] = pd.to_numeric(cleaned_analytics['monthly_revenue'])\n\n# Active status to boolean\ncleaned_analytics['is_active'] = cleaned_analytics['is_active'].astype('bool')\n\n# Login days to integer\ncleaned_analytics['last_login_days_ago'] = pd.to_numeric(cleaned_analytics['last_login_days_ago'])\n\n# Sessions to integer  \ncleaned_analytics['total_sessions'] = pd.to_numeric(cleaned_analytics['total_sessions'])\n\n# Conversion rate (remove % and convert)\ncleaned_analytics['conversion_rate'] = cleaned_analytics['conversion_rate'].str.replace('%', '')\ncleaned_analytics['conversion_rate'] = pd.to_numeric(cleaned_analytics['conversion_rate'])\n\nprint(\"✅ Conversion complete!\")\nprint(\"New data types:\")\nprint(cleaned_analytics.dtypes)\nprint()\n\nprint(\"🎯 Now we can do real analysis:\")\nprint(f\"Active users: {cleaned_analytics['is_active'].sum()}/{len(cleaned_analytics)}\")\nprint(f\"Average revenue: ${cleaned_analytics['monthly_revenue'].mean():.2f}\")\nprint(f\"Average conversion rate: {cleaned_analytics['conversion_rate'].mean():.1f}%\")\nprint(f\"Days since signup (average): {(pd.Timestamp.now() - cleaned_analytics['signup_date']).dt.days.mean():.0f} days\")\n",[8527],{"type":393,"tag":441,"props":8528,"children":8529},{"__ignoreMap":6},[8530,8549,8556,8564,8580,8637,8688,8742,8795,8847,8901,8956,9013,9020,9027,9047,9059,9070,9090,9101,9108,9116,9136,9153,9160,9180,9188,9222,9229,9237,9270,9277,9285,9326,9333,9341,9373,9380,9388,9428,9435,9443,9475,9482,9490,9522,9529,9537,9585,9616,9623,9643,9663,9675,9686,9693,9713,9781,9834,9888],{"type":393,"tag":601,"props":8531,"children":8532},{"class":603,"line":11},[8533,8537,8541,8545],{"type":393,"tag":601,"props":8534,"children":8535},{"style":607},[8536],{"type":398,"value":610},{"type":393,"tag":601,"props":8538,"children":8539},{"style":613},[8540],{"type":398,"value":616},{"type":393,"tag":601,"props":8542,"children":8543},{"style":607},[8544],{"type":398,"value":621},{"type":393,"tag":601,"props":8546,"children":8547},{"style":613},[8548],{"type":398,"value":626},{"type":393,"tag":601,"props":8550,"children":8551},{"class":603,"line":27},[8552],{"type":393,"tag":601,"props":8553,"children":8554},{"emptyLinePlaceholder":12},[8555],{"type":398,"value":634},{"type":393,"tag":601,"props":8557,"children":8558},{"class":603,"line":36},[8559],{"type":393,"tag":601,"props":8560,"children":8561},{"style":640},[8562],{"type":398,"value":8563},"# Customer analytics data export (typical format from many systems)\n",{"type":393,"tag":601,"props":8565,"children":8566},{"class":603,"line":45},[8567,8572,8576],{"type":393,"tag":601,"props":8568,"children":8569},{"style":613},[8570],{"type":398,"value":8571},"analytics_export ",{"type":393,"tag":601,"props":8573,"children":8574},{"style":607},[8575],{"type":398,"value":656},{"type":393,"tag":601,"props":8577,"children":8578},{"style":613},[8579],{"type":398,"value":661},{"type":393,"tag":601,"props":8581,"children":8582},{"class":603,"line":54},[8583,8588,8592,8597,8601,8606,8610,8615,8619,8624,8628,8633],{"type":393,"tag":601,"props":8584,"children":8585},{"style":667},[8586],{"type":398,"value":8587},"    'user_id'",{"type":393,"tag":601,"props":8589,"children":8590},{"style":613},[8591],{"type":398,"value":675},{"type":393,"tag":601,"props":8593,"children":8594},{"style":667},[8595],{"type":398,"value":8596},"'10001'",{"type":393,"tag":601,"props":8598,"children":8599},{"style":613},[8600],{"type":398,"value":685},{"type":393,"tag":601,"props":8602,"children":8603},{"style":667},[8604],{"type":398,"value":8605},"'10002'",{"type":393,"tag":601,"props":8607,"children":8608},{"style":613},[8609],{"type":398,"value":685},{"type":393,"tag":601,"props":8611,"children":8612},{"style":667},[8613],{"type":398,"value":8614},"'10003'",{"type":393,"tag":601,"props":8616,"children":8617},{"style":613},[8618],{"type":398,"value":685},{"type":393,"tag":601,"props":8620,"children":8621},{"style":667},[8622],{"type":398,"value":8623},"'10004'",{"type":393,"tag":601,"props":8625,"children":8626},{"style":613},[8627],{"type":398,"value":685},{"type":393,"tag":601,"props":8629,"children":8630},{"style":667},[8631],{"type":398,"value":8632},"'10005'",{"type":393,"tag":601,"props":8634,"children":8635},{"style":613},[8636],{"type":398,"value":1432},{"type":393,"tag":601,"props":8638,"children":8639},{"class":603,"line":63},[8640,8644,8648,8652,8656,8660,8664,8668,8672,8676,8680,8684],{"type":393,"tag":601,"props":8641,"children":8642},{"style":667},[8643],{"type":398,"value":858},{"type":393,"tag":601,"props":8645,"children":8646},{"style":613},[8647],{"type":398,"value":675},{"type":393,"tag":601,"props":8649,"children":8650},{"style":667},[8651],{"type":398,"value":867},{"type":393,"tag":601,"props":8653,"children":8654},{"style":613},[8655],{"type":398,"value":685},{"type":393,"tag":601,"props":8657,"children":8658},{"style":667},[8659],{"type":398,"value":876},{"type":393,"tag":601,"props":8661,"children":8662},{"style":613},[8663],{"type":398,"value":685},{"type":393,"tag":601,"props":8665,"children":8666},{"style":667},[8667],{"type":398,"value":885},{"type":393,"tag":601,"props":8669,"children":8670},{"style":613},[8671],{"type":398,"value":685},{"type":393,"tag":601,"props":8673,"children":8674},{"style":667},[8675],{"type":398,"value":894},{"type":393,"tag":601,"props":8677,"children":8678},{"style":613},[8679],{"type":398,"value":685},{"type":393,"tag":601,"props":8681,"children":8682},{"style":667},[8683],{"type":398,"value":903},{"type":393,"tag":601,"props":8685,"children":8686},{"style":613},[8687],{"type":398,"value":1432},{"type":393,"tag":601,"props":8689,"children":8690},{"class":603,"line":72},[8691,8696,8700,8705,8709,8714,8718,8722,8726,8730,8734,8738],{"type":393,"tag":601,"props":8692,"children":8693},{"style":667},[8694],{"type":398,"value":8695},"    'subscription_type'",{"type":393,"tag":601,"props":8697,"children":8698},{"style":613},[8699],{"type":398,"value":675},{"type":393,"tag":601,"props":8701,"children":8702},{"style":667},[8703],{"type":398,"value":8704},"'Premium'",{"type":393,"tag":601,"props":8706,"children":8707},{"style":613},[8708],{"type":398,"value":685},{"type":393,"tag":601,"props":8710,"children":8711},{"style":667},[8712],{"type":398,"value":8713},"'Basic'",{"type":393,"tag":601,"props":8715,"children":8716},{"style":613},[8717],{"type":398,"value":685},{"type":393,"tag":601,"props":8719,"children":8720},{"style":667},[8721],{"type":398,"value":8704},{"type":393,"tag":601,"props":8723,"children":8724},{"style":613},[8725],{"type":398,"value":685},{"type":393,"tag":601,"props":8727,"children":8728},{"style":667},[8729],{"type":398,"value":8713},{"type":393,"tag":601,"props":8731,"children":8732},{"style":613},[8733],{"type":398,"value":685},{"type":393,"tag":601,"props":8735,"children":8736},{"style":667},[8737],{"type":398,"value":8704},{"type":393,"tag":601,"props":8739,"children":8740},{"style":613},[8741],{"type":398,"value":1432},{"type":393,"tag":601,"props":8743,"children":8744},{"class":603,"line":83},[8745,8750,8754,8758,8762,8767,8771,8775,8779,8783,8787,8791],{"type":393,"tag":601,"props":8746,"children":8747},{"style":667},[8748],{"type":398,"value":8749},"    'monthly_revenue'",{"type":393,"tag":601,"props":8751,"children":8752},{"style":613},[8753],{"type":398,"value":675},{"type":393,"tag":601,"props":8755,"children":8756},{"style":667},[8757],{"type":398,"value":1449},{"type":393,"tag":601,"props":8759,"children":8760},{"style":613},[8761],{"type":398,"value":685},{"type":393,"tag":601,"props":8763,"children":8764},{"style":667},[8765],{"type":398,"value":8766},"'9.99'",{"type":393,"tag":601,"props":8768,"children":8769},{"style":613},[8770],{"type":398,"value":685},{"type":393,"tag":601,"props":8772,"children":8773},{"style":667},[8774],{"type":398,"value":1449},{"type":393,"tag":601,"props":8776,"children":8777},{"style":613},[8778],{"type":398,"value":685},{"type":393,"tag":601,"props":8780,"children":8781},{"style":667},[8782],{"type":398,"value":8766},{"type":393,"tag":601,"props":8784,"children":8785},{"style":613},[8786],{"type":398,"value":685},{"type":393,"tag":601,"props":8788,"children":8789},{"style":667},[8790],{"type":398,"value":1449},{"type":393,"tag":601,"props":8792,"children":8793},{"style":613},[8794],{"type":398,"value":1432},{"type":393,"tag":601,"props":8796,"children":8797},{"class":603,"line":92},[8798,8803,8807,8811,8815,8819,8823,8827,8831,8835,8839,8843],{"type":393,"tag":601,"props":8799,"children":8800},{"style":667},[8801],{"type":398,"value":8802},"    'is_active'",{"type":393,"tag":601,"props":8804,"children":8805},{"style":613},[8806],{"type":398,"value":675},{"type":393,"tag":601,"props":8808,"children":8809},{"style":667},[8810],{"type":398,"value":680},{"type":393,"tag":601,"props":8812,"children":8813},{"style":613},[8814],{"type":398,"value":685},{"type":393,"tag":601,"props":8816,"children":8817},{"style":667},[8818],{"type":398,"value":680},{"type":393,"tag":601,"props":8820,"children":8821},{"style":613},[8822],{"type":398,"value":685},{"type":393,"tag":601,"props":8824,"children":8825},{"style":667},[8826],{"type":398,"value":3267},{"type":393,"tag":601,"props":8828,"children":8829},{"style":613},[8830],{"type":398,"value":685},{"type":393,"tag":601,"props":8832,"children":8833},{"style":667},[8834],{"type":398,"value":680},{"type":393,"tag":601,"props":8836,"children":8837},{"style":613},[8838],{"type":398,"value":685},{"type":393,"tag":601,"props":8840,"children":8841},{"style":667},[8842],{"type":398,"value":680},{"type":393,"tag":601,"props":8844,"children":8845},{"style":613},[8846],{"type":398,"value":1432},{"type":393,"tag":601,"props":8848,"children":8849},{"class":603,"line":101},[8850,8855,8859,8863,8867,8871,8875,8880,8884,8889,8893,8897],{"type":393,"tag":601,"props":8851,"children":8852},{"style":667},[8853],{"type":398,"value":8854},"    'last_login_days_ago'",{"type":393,"tag":601,"props":8856,"children":8857},{"style":613},[8858],{"type":398,"value":675},{"type":393,"tag":601,"props":8860,"children":8861},{"style":667},[8862],{"type":398,"value":699},{"type":393,"tag":601,"props":8864,"children":8865},{"style":613},[8866],{"type":398,"value":685},{"type":393,"tag":601,"props":8868,"children":8869},{"style":667},[8870],{"type":398,"value":1551},{"type":393,"tag":601,"props":8872,"children":8873},{"style":613},[8874],{"type":398,"value":685},{"type":393,"tag":601,"props":8876,"children":8877},{"style":667},[8878],{"type":398,"value":8879},"'45'",{"type":393,"tag":601,"props":8881,"children":8882},{"style":613},[8883],{"type":398,"value":685},{"type":393,"tag":601,"props":8885,"children":8886},{"style":667},[8887],{"type":398,"value":8888},"'7'",{"type":393,"tag":601,"props":8890,"children":8891},{"style":613},[8892],{"type":398,"value":685},{"type":393,"tag":601,"props":8894,"children":8895},{"style":667},[8896],{"type":398,"value":680},{"type":393,"tag":601,"props":8898,"children":8899},{"style":613},[8900],{"type":398,"value":1432},{"type":393,"tag":601,"props":8902,"children":8903},{"class":603,"line":110},[8904,8909,8913,8918,8922,8926,8930,8934,8938,8943,8947,8952],{"type":393,"tag":601,"props":8905,"children":8906},{"style":667},[8907],{"type":398,"value":8908},"    'total_sessions'",{"type":393,"tag":601,"props":8910,"children":8911},{"style":613},[8912],{"type":398,"value":675},{"type":393,"tag":601,"props":8914,"children":8915},{"style":667},[8916],{"type":398,"value":8917},"'125'",{"type":393,"tag":601,"props":8919,"children":8920},{"style":613},[8921],{"type":398,"value":685},{"type":393,"tag":601,"props":8923,"children":8924},{"style":667},[8925],{"type":398,"value":8879},{"type":393,"tag":601,"props":8927,"children":8928},{"style":613},[8929],{"type":398,"value":685},{"type":393,"tag":601,"props":8931,"children":8932},{"style":667},[8933],{"type":398,"value":1513},{"type":393,"tag":601,"props":8935,"children":8936},{"style":613},[8937],{"type":398,"value":685},{"type":393,"tag":601,"props":8939,"children":8940},{"style":667},[8941],{"type":398,"value":8942},"'67'",{"type":393,"tag":601,"props":8944,"children":8945},{"style":613},[8946],{"type":398,"value":685},{"type":393,"tag":601,"props":8948,"children":8949},{"style":667},[8950],{"type":398,"value":8951},"'189'",{"type":393,"tag":601,"props":8953,"children":8954},{"style":613},[8955],{"type":398,"value":1432},{"type":393,"tag":601,"props":8957,"children":8958},{"class":603,"line":121},[8959,8964,8968,8973,8977,8982,8986,8991,8995,9000,9004,9009],{"type":393,"tag":601,"props":8960,"children":8961},{"style":667},[8962],{"type":398,"value":8963},"    'conversion_rate'",{"type":393,"tag":601,"props":8965,"children":8966},{"style":613},[8967],{"type":398,"value":675},{"type":393,"tag":601,"props":8969,"children":8970},{"style":667},[8971],{"type":398,"value":8972},"'15.5%'",{"type":393,"tag":601,"props":8974,"children":8975},{"style":613},[8976],{"type":398,"value":685},{"type":393,"tag":601,"props":8978,"children":8979},{"style":667},[8980],{"type":398,"value":8981},"'8.2%'",{"type":393,"tag":601,"props":8983,"children":8984},{"style":613},[8985],{"type":398,"value":685},{"type":393,"tag":601,"props":8987,"children":8988},{"style":667},[8989],{"type":398,"value":8990},"'3.1%'",{"type":393,"tag":601,"props":8992,"children":8993},{"style":613},[8994],{"type":398,"value":685},{"type":393,"tag":601,"props":8996,"children":8997},{"style":667},[8998],{"type":398,"value":8999},"'12.8%'",{"type":393,"tag":601,"props":9001,"children":9002},{"style":613},[9003],{"type":398,"value":685},{"type":393,"tag":601,"props":9005,"children":9006},{"style":667},[9007],{"type":398,"value":9008},"'18.9%'",{"type":393,"tag":601,"props":9010,"children":9011},{"style":613},[9012],{"type":398,"value":1573},{"type":393,"tag":601,"props":9014,"children":9015},{"class":603,"line":130},[9016],{"type":393,"tag":601,"props":9017,"children":9018},{"style":613},[9019],{"type":398,"value":1041},{"type":393,"tag":601,"props":9021,"children":9022},{"class":603,"line":139},[9023],{"type":393,"tag":601,"props":9024,"children":9025},{"emptyLinePlaceholder":12},[9026],{"type":398,"value":634},{"type":393,"tag":601,"props":9028,"children":9029},{"class":603,"line":148},[9030,9034,9038,9043],{"type":393,"tag":601,"props":9031,"children":9032},{"style":1054},[9033],{"type":398,"value":1057},{"type":393,"tag":601,"props":9035,"children":9036},{"style":613},[9037],{"type":398,"value":1062},{"type":393,"tag":601,"props":9039,"children":9040},{"style":667},[9041],{"type":398,"value":9042},"\"🎮 Analytics Export Challenge:\"",{"type":393,"tag":601,"props":9044,"children":9045},{"style":613},[9046],{"type":398,"value":1072},{"type":393,"tag":601,"props":9048,"children":9049},{"class":603,"line":159},[9050,9054],{"type":393,"tag":601,"props":9051,"children":9052},{"style":1054},[9053],{"type":398,"value":1057},{"type":393,"tag":601,"props":9055,"children":9056},{"style":613},[9057],{"type":398,"value":9058},"(analytics_export)\n",{"type":393,"tag":601,"props":9060,"children":9061},{"class":603,"line":168},[9062,9066],{"type":393,"tag":601,"props":9063,"children":9064},{"style":1054},[9065],{"type":398,"value":1057},{"type":393,"tag":601,"props":9067,"children":9068},{"style":613},[9069],{"type":398,"value":1096},{"type":393,"tag":601,"props":9071,"children":9072},{"class":603,"line":177},[9073,9077,9081,9086],{"type":393,"tag":601,"props":9074,"children":9075},{"style":1054},[9076],{"type":398,"value":1057},{"type":393,"tag":601,"props":9078,"children":9079},{"style":613},[9080],{"type":398,"value":1062},{"type":393,"tag":601,"props":9082,"children":9083},{"style":667},[9084],{"type":398,"value":9085},"\"Mission: Convert all columns to appropriate types for analysis\"",{"type":393,"tag":601,"props":9087,"children":9088},{"style":613},[9089],{"type":398,"value":1072},{"type":393,"tag":601,"props":9091,"children":9092},{"class":603,"line":186},[9093,9097],{"type":393,"tag":601,"props":9094,"children":9095},{"style":1054},[9096],{"type":398,"value":1057},{"type":393,"tag":601,"props":9098,"children":9099},{"style":613},[9100],{"type":398,"value":1096},{"type":393,"tag":601,"props":9102,"children":9103},{"class":603,"line":197},[9104],{"type":393,"tag":601,"props":9105,"children":9106},{"emptyLinePlaceholder":12},[9107],{"type":398,"value":634},{"type":393,"tag":601,"props":9109,"children":9110},{"class":603,"line":206},[9111],{"type":393,"tag":601,"props":9112,"children":9113},{"style":640},[9114],{"type":398,"value":9115},"# Solution\n",{"type":393,"tag":601,"props":9117,"children":9118},{"class":603,"line":215},[9119,9123,9127,9132],{"type":393,"tag":601,"props":9120,"children":9121},{"style":1054},[9122],{"type":398,"value":1057},{"type":393,"tag":601,"props":9124,"children":9125},{"style":613},[9126],{"type":398,"value":1062},{"type":393,"tag":601,"props":9128,"children":9129},{"style":667},[9130],{"type":398,"value":9131},"\"🔄 Conversion Solution:\"",{"type":393,"tag":601,"props":9133,"children":9134},{"style":613},[9135],{"type":398,"value":1072},{"type":393,"tag":601,"props":9137,"children":9138},{"class":603,"line":224},[9139,9144,9148],{"type":393,"tag":601,"props":9140,"children":9141},{"style":613},[9142],{"type":398,"value":9143},"cleaned_analytics ",{"type":393,"tag":601,"props":9145,"children":9146},{"style":607},[9147],{"type":398,"value":656},{"type":393,"tag":601,"props":9149,"children":9150},{"style":613},[9151],{"type":398,"value":9152}," analytics_export.copy()\n",{"type":393,"tag":601,"props":9154,"children":9155},{"class":603,"line":233},[9156],{"type":393,"tag":601,"props":9157,"children":9158},{"emptyLinePlaceholder":12},[9159],{"type":398,"value":634},{"type":393,"tag":601,"props":9161,"children":9162},{"class":603,"line":244},[9163,9167,9171,9176],{"type":393,"tag":601,"props":9164,"children":9165},{"style":1054},[9166],{"type":398,"value":1057},{"type":393,"tag":601,"props":9168,"children":9169},{"style":613},[9170],{"type":398,"value":1062},{"type":393,"tag":601,"props":9172,"children":9173},{"style":667},[9174],{"type":398,"value":9175},"\"Converting each column...\"",{"type":393,"tag":601,"props":9177,"children":9178},{"style":613},[9179],{"type":398,"value":1072},{"type":393,"tag":601,"props":9181,"children":9182},{"class":603,"line":253},[9183],{"type":393,"tag":601,"props":9184,"children":9185},{"style":640},[9186],{"type":398,"value":9187},"# User ID to integer\n",{"type":393,"tag":601,"props":9189,"children":9190},{"class":603,"line":262},[9191,9196,9201,9205,9209,9214,9218],{"type":393,"tag":601,"props":9192,"children":9193},{"style":613},[9194],{"type":398,"value":9195},"cleaned_analytics[",{"type":393,"tag":601,"props":9197,"children":9198},{"style":667},[9199],{"type":398,"value":9200},"'user_id'",{"type":393,"tag":601,"props":9202,"children":9203},{"style":613},[9204],{"type":398,"value":1759},{"type":393,"tag":601,"props":9206,"children":9207},{"style":607},[9208],{"type":398,"value":656},{"type":393,"tag":601,"props":9210,"children":9211},{"style":613},[9212],{"type":398,"value":9213}," pd.to_numeric(cleaned_analytics[",{"type":393,"tag":601,"props":9215,"children":9216},{"style":667},[9217],{"type":398,"value":9200},{"type":393,"tag":601,"props":9219,"children":9220},{"style":613},[9221],{"type":398,"value":2016},{"type":393,"tag":601,"props":9223,"children":9224},{"class":603,"line":271},[9225],{"type":393,"tag":601,"props":9226,"children":9227},{"emptyLinePlaceholder":12},[9228],{"type":398,"value":634},{"type":393,"tag":601,"props":9230,"children":9231},{"class":603,"line":281},[9232],{"type":393,"tag":601,"props":9233,"children":9234},{"style":640},[9235],{"type":398,"value":9236},"# Signup date to datetime\n",{"type":393,"tag":601,"props":9238,"children":9239},{"class":603,"line":290},[9240,9244,9249,9253,9257,9262,9266],{"type":393,"tag":601,"props":9241,"children":9242},{"style":613},[9243],{"type":398,"value":9195},{"type":393,"tag":601,"props":9245,"children":9246},{"style":667},[9247],{"type":398,"value":9248},"'signup_date'",{"type":393,"tag":601,"props":9250,"children":9251},{"style":613},[9252],{"type":398,"value":1759},{"type":393,"tag":601,"props":9254,"children":9255},{"style":607},[9256],{"type":398,"value":656},{"type":393,"tag":601,"props":9258,"children":9259},{"style":613},[9260],{"type":398,"value":9261}," pd.to_datetime(cleaned_analytics[",{"type":393,"tag":601,"props":9263,"children":9264},{"style":667},[9265],{"type":398,"value":9248},{"type":393,"tag":601,"props":9267,"children":9268},{"style":613},[9269],{"type":398,"value":2016},{"type":393,"tag":601,"props":9271,"children":9272},{"class":603,"line":299},[9273],{"type":393,"tag":601,"props":9274,"children":9275},{"emptyLinePlaceholder":12},[9276],{"type":398,"value":634},{"type":393,"tag":601,"props":9278,"children":9279},{"class":603,"line":308},[9280],{"type":393,"tag":601,"props":9281,"children":9282},{"style":640},[9283],{"type":398,"value":9284},"# Subscription type to category\n",{"type":393,"tag":601,"props":9286,"children":9287},{"class":603,"line":318},[9288,9292,9297,9301,9305,9310,9314,9318,9322],{"type":393,"tag":601,"props":9289,"children":9290},{"style":613},[9291],{"type":398,"value":9195},{"type":393,"tag":601,"props":9293,"children":9294},{"style":667},[9295],{"type":398,"value":9296},"'subscription_type'",{"type":393,"tag":601,"props":9298,"children":9299},{"style":613},[9300],{"type":398,"value":1759},{"type":393,"tag":601,"props":9302,"children":9303},{"style":607},[9304],{"type":398,"value":656},{"type":393,"tag":601,"props":9306,"children":9307},{"style":613},[9308],{"type":398,"value":9309}," cleaned_analytics[",{"type":393,"tag":601,"props":9311,"children":9312},{"style":667},[9313],{"type":398,"value":9296},{"type":393,"tag":601,"props":9315,"children":9316},{"style":613},[9317],{"type":398,"value":1777},{"type":393,"tag":601,"props":9319,"children":9320},{"style":667},[9321],{"type":398,"value":4551},{"type":393,"tag":601,"props":9323,"children":9324},{"style":613},[9325],{"type":398,"value":1072},{"type":393,"tag":601,"props":9327,"children":9328},{"class":603,"line":327},[9329],{"type":393,"tag":601,"props":9330,"children":9331},{"emptyLinePlaceholder":12},[9332],{"type":398,"value":634},{"type":393,"tag":601,"props":9334,"children":9335},{"class":603,"line":336},[9336],{"type":393,"tag":601,"props":9337,"children":9338},{"style":640},[9339],{"type":398,"value":9340},"# Revenue to float\n",{"type":393,"tag":601,"props":9342,"children":9343},{"class":603,"line":346},[9344,9348,9353,9357,9361,9365,9369],{"type":393,"tag":601,"props":9345,"children":9346},{"style":613},[9347],{"type":398,"value":9195},{"type":393,"tag":601,"props":9349,"children":9350},{"style":667},[9351],{"type":398,"value":9352},"'monthly_revenue'",{"type":393,"tag":601,"props":9354,"children":9355},{"style":613},[9356],{"type":398,"value":1759},{"type":393,"tag":601,"props":9358,"children":9359},{"style":607},[9360],{"type":398,"value":656},{"type":393,"tag":601,"props":9362,"children":9363},{"style":613},[9364],{"type":398,"value":9213},{"type":393,"tag":601,"props":9366,"children":9367},{"style":667},[9368],{"type":398,"value":9352},{"type":393,"tag":601,"props":9370,"children":9371},{"style":613},[9372],{"type":398,"value":2016},{"type":393,"tag":601,"props":9374,"children":9375},{"class":603,"line":355},[9376],{"type":393,"tag":601,"props":9377,"children":9378},{"emptyLinePlaceholder":12},[9379],{"type":398,"value":634},{"type":393,"tag":601,"props":9381,"children":9382},{"class":603,"line":364},[9383],{"type":393,"tag":601,"props":9384,"children":9385},{"style":640},[9386],{"type":398,"value":9387},"# Active status to boolean\n",{"type":393,"tag":601,"props":9389,"children":9390},{"class":603,"line":374},[9391,9395,9400,9404,9408,9412,9416,9420,9424],{"type":393,"tag":601,"props":9392,"children":9393},{"style":613},[9394],{"type":398,"value":9195},{"type":393,"tag":601,"props":9396,"children":9397},{"style":667},[9398],{"type":398,"value":9399},"'is_active'",{"type":393,"tag":601,"props":9401,"children":9402},{"style":613},[9403],{"type":398,"value":1759},{"type":393,"tag":601,"props":9405,"children":9406},{"style":607},[9407],{"type":398,"value":656},{"type":393,"tag":601,"props":9409,"children":9410},{"style":613},[9411],{"type":398,"value":9309},{"type":393,"tag":601,"props":9413,"children":9414},{"style":667},[9415],{"type":398,"value":9399},{"type":393,"tag":601,"props":9417,"children":9418},{"style":613},[9419],{"type":398,"value":1777},{"type":393,"tag":601,"props":9421,"children":9422},{"style":667},[9423],{"type":398,"value":3776},{"type":393,"tag":601,"props":9425,"children":9426},{"style":613},[9427],{"type":398,"value":1072},{"type":393,"tag":601,"props":9429,"children":9430},{"class":603,"line":383},[9431],{"type":393,"tag":601,"props":9432,"children":9433},{"emptyLinePlaceholder":12},[9434],{"type":398,"value":634},{"type":393,"tag":601,"props":9436,"children":9437},{"class":603,"line":3949},[9438],{"type":393,"tag":601,"props":9439,"children":9440},{"style":640},[9441],{"type":398,"value":9442},"# Login days to integer\n",{"type":393,"tag":601,"props":9444,"children":9445},{"class":603,"line":3961},[9446,9450,9455,9459,9463,9467,9471],{"type":393,"tag":601,"props":9447,"children":9448},{"style":613},[9449],{"type":398,"value":9195},{"type":393,"tag":601,"props":9451,"children":9452},{"style":667},[9453],{"type":398,"value":9454},"'last_login_days_ago'",{"type":393,"tag":601,"props":9456,"children":9457},{"style":613},[9458],{"type":398,"value":1759},{"type":393,"tag":601,"props":9460,"children":9461},{"style":607},[9462],{"type":398,"value":656},{"type":393,"tag":601,"props":9464,"children":9465},{"style":613},[9466],{"type":398,"value":9213},{"type":393,"tag":601,"props":9468,"children":9469},{"style":667},[9470],{"type":398,"value":9454},{"type":393,"tag":601,"props":9472,"children":9473},{"style":613},[9474],{"type":398,"value":2016},{"type":393,"tag":601,"props":9476,"children":9477},{"class":603,"line":3969},[9478],{"type":393,"tag":601,"props":9479,"children":9480},{"emptyLinePlaceholder":12},[9481],{"type":398,"value":634},{"type":393,"tag":601,"props":9483,"children":9484},{"class":603,"line":3990},[9485],{"type":393,"tag":601,"props":9486,"children":9487},{"style":640},[9488],{"type":398,"value":9489},"# Sessions to integer  \n",{"type":393,"tag":601,"props":9491,"children":9492},{"class":603,"line":4927},[9493,9497,9502,9506,9510,9514,9518],{"type":393,"tag":601,"props":9494,"children":9495},{"style":613},[9496],{"type":398,"value":9195},{"type":393,"tag":601,"props":9498,"children":9499},{"style":667},[9500],{"type":398,"value":9501},"'total_sessions'",{"type":393,"tag":601,"props":9503,"children":9504},{"style":613},[9505],{"type":398,"value":1759},{"type":393,"tag":601,"props":9507,"children":9508},{"style":607},[9509],{"type":398,"value":656},{"type":393,"tag":601,"props":9511,"children":9512},{"style":613},[9513],{"type":398,"value":9213},{"type":393,"tag":601,"props":9515,"children":9516},{"style":667},[9517],{"type":398,"value":9501},{"type":393,"tag":601,"props":9519,"children":9520},{"style":613},[9521],{"type":398,"value":2016},{"type":393,"tag":601,"props":9523,"children":9524},{"class":603,"line":4948},[9525],{"type":393,"tag":601,"props":9526,"children":9527},{"emptyLinePlaceholder":12},[9528],{"type":398,"value":634},{"type":393,"tag":601,"props":9530,"children":9531},{"class":603,"line":6020},[9532],{"type":393,"tag":601,"props":9533,"children":9534},{"style":640},[9535],{"type":398,"value":9536},"# Conversion rate (remove % and convert)\n",{"type":393,"tag":601,"props":9538,"children":9539},{"class":603,"line":6070},[9540,9544,9549,9553,9557,9561,9565,9569,9573,9577,9581],{"type":393,"tag":601,"props":9541,"children":9542},{"style":613},[9543],{"type":398,"value":9195},{"type":393,"tag":601,"props":9545,"children":9546},{"style":667},[9547],{"type":398,"value":9548},"'conversion_rate'",{"type":393,"tag":601,"props":9550,"children":9551},{"style":613},[9552],{"type":398,"value":1759},{"type":393,"tag":601,"props":9554,"children":9555},{"style":607},[9556],{"type":398,"value":656},{"type":393,"tag":601,"props":9558,"children":9559},{"style":613},[9560],{"type":398,"value":9309},{"type":393,"tag":601,"props":9562,"children":9563},{"style":667},[9564],{"type":398,"value":9548},{"type":393,"tag":601,"props":9566,"children":9567},{"style":613},[9568],{"type":398,"value":5631},{"type":393,"tag":601,"props":9570,"children":9571},{"style":667},[9572],{"type":398,"value":5636},{"type":393,"tag":601,"props":9574,"children":9575},{"style":613},[9576],{"type":398,"value":685},{"type":393,"tag":601,"props":9578,"children":9579},{"style":667},[9580],{"type":398,"value":5645},{"type":393,"tag":601,"props":9582,"children":9583},{"style":613},[9584],{"type":398,"value":1072},{"type":393,"tag":601,"props":9586,"children":9587},{"class":603,"line":7147},[9588,9592,9596,9600,9604,9608,9612],{"type":393,"tag":601,"props":9589,"children":9590},{"style":613},[9591],{"type":398,"value":9195},{"type":393,"tag":601,"props":9593,"children":9594},{"style":667},[9595],{"type":398,"value":9548},{"type":393,"tag":601,"props":9597,"children":9598},{"style":613},[9599],{"type":398,"value":1759},{"type":393,"tag":601,"props":9601,"children":9602},{"style":607},[9603],{"type":398,"value":656},{"type":393,"tag":601,"props":9605,"children":9606},{"style":613},[9607],{"type":398,"value":9213},{"type":393,"tag":601,"props":9609,"children":9610},{"style":667},[9611],{"type":398,"value":9548},{"type":393,"tag":601,"props":9613,"children":9614},{"style":613},[9615],{"type":398,"value":2016},{"type":393,"tag":601,"props":9617,"children":9618},{"class":603,"line":7160},[9619],{"type":393,"tag":601,"props":9620,"children":9621},{"emptyLinePlaceholder":12},[9622],{"type":398,"value":634},{"type":393,"tag":601,"props":9624,"children":9625},{"class":603,"line":7172},[9626,9630,9634,9639],{"type":393,"tag":601,"props":9627,"children":9628},{"style":1054},[9629],{"type":398,"value":1057},{"type":393,"tag":601,"props":9631,"children":9632},{"style":613},[9633],{"type":398,"value":1062},{"type":393,"tag":601,"props":9635,"children":9636},{"style":667},[9637],{"type":398,"value":9638},"\"✅ Conversion complete!\"",{"type":393,"tag":601,"props":9640,"children":9641},{"style":613},[9642],{"type":398,"value":1072},{"type":393,"tag":601,"props":9644,"children":9645},{"class":603,"line":7193},[9646,9650,9654,9659],{"type":393,"tag":601,"props":9647,"children":9648},{"style":1054},[9649],{"type":398,"value":1057},{"type":393,"tag":601,"props":9651,"children":9652},{"style":613},[9653],{"type":398,"value":1062},{"type":393,"tag":601,"props":9655,"children":9656},{"style":667},[9657],{"type":398,"value":9658},"\"New data types:\"",{"type":393,"tag":601,"props":9660,"children":9661},{"style":613},[9662],{"type":398,"value":1072},{"type":393,"tag":601,"props":9664,"children":9665},{"class":603,"line":7205},[9666,9670],{"type":393,"tag":601,"props":9667,"children":9668},{"style":1054},[9669],{"type":398,"value":1057},{"type":393,"tag":601,"props":9671,"children":9672},{"style":613},[9673],{"type":398,"value":9674},"(cleaned_analytics.dtypes)\n",{"type":393,"tag":601,"props":9676,"children":9677},{"class":603,"line":7213},[9678,9682],{"type":393,"tag":601,"props":9679,"children":9680},{"style":1054},[9681],{"type":398,"value":1057},{"type":393,"tag":601,"props":9683,"children":9684},{"style":613},[9685],{"type":398,"value":1096},{"type":393,"tag":601,"props":9687,"children":9688},{"class":603,"line":7234},[9689],{"type":393,"tag":601,"props":9690,"children":9691},{"emptyLinePlaceholder":12},[9692],{"type":398,"value":634},{"type":393,"tag":601,"props":9694,"children":9695},{"class":603,"line":7311},[9696,9700,9704,9709],{"type":393,"tag":601,"props":9697,"children":9698},{"style":1054},[9699],{"type":398,"value":1057},{"type":393,"tag":601,"props":9701,"children":9702},{"style":613},[9703],{"type":398,"value":1062},{"type":393,"tag":601,"props":9705,"children":9706},{"style":667},[9707],{"type":398,"value":9708},"\"🎯 Now we can do real analysis:\"",{"type":393,"tag":601,"props":9710,"children":9711},{"style":613},[9712],{"type":398,"value":1072},{"type":393,"tag":601,"props":9714,"children":9715},{"class":603,"line":7366},[9716,9720,9724,9728,9733,9737,9741,9745,9750,9754,9759,9764,9769,9773,9777],{"type":393,"tag":601,"props":9717,"children":9718},{"style":1054},[9719],{"type":398,"value":1057},{"type":393,"tag":601,"props":9721,"children":9722},{"style":613},[9723],{"type":398,"value":1062},{"type":393,"tag":601,"props":9725,"children":9726},{"style":607},[9727],{"type":398,"value":7248},{"type":393,"tag":601,"props":9729,"children":9730},{"style":667},[9731],{"type":398,"value":9732},"\"Active users: ",{"type":393,"tag":601,"props":9734,"children":9735},{"style":1054},[9736],{"type":398,"value":7258},{"type":393,"tag":601,"props":9738,"children":9739},{"style":613},[9740],{"type":398,"value":9195},{"type":393,"tag":601,"props":9742,"children":9743},{"style":667},[9744],{"type":398,"value":9399},{"type":393,"tag":601,"props":9746,"children":9747},{"style":613},[9748],{"type":398,"value":9749},"].sum()",{"type":393,"tag":601,"props":9751,"children":9752},{"style":1054},[9753],{"type":398,"value":7299},{"type":393,"tag":601,"props":9755,"children":9756},{"style":667},[9757],{"type":398,"value":9758},"/",{"type":393,"tag":601,"props":9760,"children":9761},{"style":1054},[9762],{"type":398,"value":9763},"{len",{"type":393,"tag":601,"props":9765,"children":9766},{"style":613},[9767],{"type":398,"value":9768},"(cleaned_analytics)",{"type":393,"tag":601,"props":9770,"children":9771},{"style":1054},[9772],{"type":398,"value":7299},{"type":393,"tag":601,"props":9774,"children":9775},{"style":667},[9776],{"type":398,"value":7304},{"type":393,"tag":601,"props":9778,"children":9779},{"style":613},[9780],{"type":398,"value":1072},{"type":393,"tag":601,"props":9782,"children":9784},{"class":603,"line":9783},58,[9785,9789,9793,9797,9802,9806,9810,9814,9818,9822,9826,9830],{"type":393,"tag":601,"props":9786,"children":9787},{"style":1054},[9788],{"type":398,"value":1057},{"type":393,"tag":601,"props":9790,"children":9791},{"style":613},[9792],{"type":398,"value":1062},{"type":393,"tag":601,"props":9794,"children":9795},{"style":607},[9796],{"type":398,"value":7248},{"type":393,"tag":601,"props":9798,"children":9799},{"style":667},[9800],{"type":398,"value":9801},"\"Average revenue: $",{"type":393,"tag":601,"props":9803,"children":9804},{"style":1054},[9805],{"type":398,"value":7258},{"type":393,"tag":601,"props":9807,"children":9808},{"style":613},[9809],{"type":398,"value":9195},{"type":393,"tag":601,"props":9811,"children":9812},{"style":667},[9813],{"type":398,"value":9352},{"type":393,"tag":601,"props":9815,"children":9816},{"style":613},[9817],{"type":398,"value":7346},{"type":393,"tag":601,"props":9819,"children":9820},{"style":607},[9821],{"type":398,"value":7294},{"type":393,"tag":601,"props":9823,"children":9824},{"style":1054},[9825],{"type":398,"value":7299},{"type":393,"tag":601,"props":9827,"children":9828},{"style":667},[9829],{"type":398,"value":7304},{"type":393,"tag":601,"props":9831,"children":9832},{"style":613},[9833],{"type":398,"value":1072},{"type":393,"tag":601,"props":9835,"children":9837},{"class":603,"line":9836},59,[9838,9842,9846,9850,9855,9859,9863,9867,9871,9875,9879,9884],{"type":393,"tag":601,"props":9839,"children":9840},{"style":1054},[9841],{"type":398,"value":1057},{"type":393,"tag":601,"props":9843,"children":9844},{"style":613},[9845],{"type":398,"value":1062},{"type":393,"tag":601,"props":9847,"children":9848},{"style":607},[9849],{"type":398,"value":7248},{"type":393,"tag":601,"props":9851,"children":9852},{"style":667},[9853],{"type":398,"value":9854},"\"Average conversion rate: ",{"type":393,"tag":601,"props":9856,"children":9857},{"style":1054},[9858],{"type":398,"value":7258},{"type":393,"tag":601,"props":9860,"children":9861},{"style":613},[9862],{"type":398,"value":9195},{"type":393,"tag":601,"props":9864,"children":9865},{"style":667},[9866],{"type":398,"value":9548},{"type":393,"tag":601,"props":9868,"children":9869},{"style":613},[9870],{"type":398,"value":7346},{"type":393,"tag":601,"props":9872,"children":9873},{"style":607},[9874],{"type":398,"value":7405},{"type":393,"tag":601,"props":9876,"children":9877},{"style":1054},[9878],{"type":398,"value":7299},{"type":393,"tag":601,"props":9880,"children":9881},{"style":667},[9882],{"type":398,"value":9883},"%\"",{"type":393,"tag":601,"props":9885,"children":9886},{"style":613},[9887],{"type":398,"value":1072},{"type":393,"tag":601,"props":9889,"children":9891},{"class":603,"line":9890},60,[9892,9896,9900,9904,9909,9913,9918,9922,9926,9930,9935,9940,9944,9949],{"type":393,"tag":601,"props":9893,"children":9894},{"style":1054},[9895],{"type":398,"value":1057},{"type":393,"tag":601,"props":9897,"children":9898},{"style":613},[9899],{"type":398,"value":1062},{"type":393,"tag":601,"props":9901,"children":9902},{"style":607},[9903],{"type":398,"value":7248},{"type":393,"tag":601,"props":9905,"children":9906},{"style":667},[9907],{"type":398,"value":9908},"\"Days since signup (average): ",{"type":393,"tag":601,"props":9910,"children":9911},{"style":1054},[9912],{"type":398,"value":7258},{"type":393,"tag":601,"props":9914,"children":9915},{"style":613},[9916],{"type":398,"value":9917},"(pd.Timestamp.now() ",{"type":393,"tag":601,"props":9919,"children":9920},{"style":607},[9921],{"type":398,"value":2889},{"type":393,"tag":601,"props":9923,"children":9924},{"style":613},[9925],{"type":398,"value":9309},{"type":393,"tag":601,"props":9927,"children":9928},{"style":667},[9929],{"type":398,"value":9248},{"type":393,"tag":601,"props":9931,"children":9932},{"style":613},[9933],{"type":398,"value":9934},"]).dt.days.mean()",{"type":393,"tag":601,"props":9936,"children":9937},{"style":607},[9938],{"type":398,"value":9939},":.0f",{"type":393,"tag":601,"props":9941,"children":9942},{"style":1054},[9943],{"type":398,"value":7299},{"type":393,"tag":601,"props":9945,"children":9946},{"style":667},[9947],{"type":398,"value":9948}," days\"",{"type":393,"tag":601,"props":9950,"children":9951},{"style":613},[9952],{"type":398,"value":1072},{"type":393,"tag":575,"props":9954,"children":9956},{"id":9955},"whats-next",[9957],{"type":398,"value":9958},"🚀 What's Next?",{"type":393,"tag":401,"props":9960,"children":9961},{},[9962],{"type":398,"value":9963},"Fantastic! You now know how to convert data to the right types for accurate analysis. Let's complete our data cleaning journey by learning how to clean and standardize text data.",{"type":393,"tag":401,"props":9965,"children":9966},{},[9967,9972,9973],{"type":393,"tag":417,"props":9968,"children":9969},{},[9970],{"type":398,"value":9971},"Continue to",{"type":398,"value":3517},{"type":393,"tag":9974,"props":9975,"children":9976},"a",{"href":220},[9977],{"type":398,"value":221},{"type":393,"tag":401,"props":9979,"children":9980},{},[9981],{"type":398,"value":9982},"You're becoming a data type expert! 🔄✨",{"type":393,"tag":9984,"props":9985,"children":9986},"style",{},[9987],{"type":398,"value":9988},"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":9990},[9991,9992,9993,9994,9995,9996,9997,9998,9999,10000,10001],{"id":577,"depth":27,"text":580},{"id":1315,"depth":27,"text":1318},{"id":2113,"depth":27,"text":2116},{"id":3015,"depth":27,"text":3018},{"id":4003,"depth":27,"text":4006},{"id":4969,"depth":27,"text":4972},{"id":6115,"depth":27,"text":6118},{"id":7421,"depth":27,"text":7424},{"id":8218,"depth":27,"text":8221},{"id":8511,"depth":27,"text":8514},{"id":9955,"depth":27,"text":9958},1782373723606]