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