[{"data":1,"prerenderedAt":153},["ShallowReactive",2],{"topic:number-formats":3},[4,14,19,25,30,36,42,48,53,58,63,68,73,78,84,90,95,101,106,111,116,121,127,133,138,143,148],{"path":5,"title":6,"description":7,"type":8,"topics":9,"kind":13},"\u002Fadvanced-data-transformation-and-cleaning\u002Fcleaning-excel-data-with-pandas\u002Fconvert-currency-strings-to-numbers-with-pandas","Convert Currency Strings Like \"$1,234.56\" and \"(500)\" to Numbers with pandas","Amount columns exported as text — \"$1,234.56\", \"(1,200.00)\", \"-€50\", \"1.234,56 EUR\", \"750.00-\" or \"100.00 CR\" — cannot be summed. Parse every common currency format into a signed number and a separate currency code, report the values that do not parse, and write real numbers back to Excel.","how-to",[10,11,12],"data-cleaning","pandas","number-formats",null,{"path":15,"title":16,"description":17,"type":8,"topics":18,"kind":13},"\u002Fadvanced-data-transformation-and-cleaning\u002Fcleaning-excel-data-with-pandas\u002Fconvert-percentage-strings-to-numbers-with-pandas","Convert Percentage Strings Like \"12.5%\" to Numbers with pandas","A rate column that mixes typed text like \"12.5%\" with real percentage cells that pandas reads as 0.125 cannot be averaged. Convert every form — \"12.5%\", \"12,5 %\", \"-3%\", \"25 bp\", fractions and bare numbers — to one consistent fraction, flag the ambiguous values, and write them back with a percent format.",[10,11,12],{"path":20,"title":21,"description":22,"type":8,"topics":23,"kind":13},"\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-text-function-equivalent-in-pandas","Excel TEXT Function Equivalent in pandas","Turn numbers and dates into formatted text — \"1,234.50\", \"12.3%\", \"00042\", \"Mar 2026\", \"(1,234.50)\" — for labels, file names and email bodies, the way Excel's TEXT does. Map TEXT format codes to Python format specs and strftime, and fix the rounding difference that makes \"1,234.5\" come out as \"1,234\" instead of \"1,235\".",[24,12,11],"formula-equivalents",{"path":26,"title":27,"description":28,"type":8,"topics":29,"kind":13},"\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fmatch-excel-rounding-in-pandas","Match Excel Rounding in pandas","pandas and Python round halves to the nearest even number, while Excel's ROUND rounds them away from zero — so 0.125 becomes 0.12 in pandas and 0.13 in Excel. Reproduce ROUND, ROUNDUP, ROUNDDOWN and MROUND exactly, and fix totals that differ by a penny.",[24,12,11],{"path":31,"title":32,"description":33,"type":8,"topics":34,"kind":13},"\u002Fadvanced-data-transformation-and-cleaning\u002Fworking-with-dates-and-times-in-excel-data\u002Fconvert-excel-time-values-and-durations","Convert Excel Time Values and Durations in Python","Excel stores times and durations as fractions of a day, and pandas returns them as time objects, timedeltas or 1900 dates depending on the cell format. Turn them all into timedeltas, handle shifts that cross midnight, parse durations typed as text and write durations back so Excel shows hours, not \"1\".",[35,12,11],"dates-and-times",{"path":37,"title":38,"description":39,"type":8,"topics":40,"kind":13},"\u002Fautomating-reporting-workflows\u002Fbuilding-multi-sheet-excel-dashboards\u002Fadd-variance-arrows-and-trend-indicators-to-a-dashboard","Add Variance Arrows and Trend Indicators to a Dashboard","Show at a glance whether each dashboard figure moved the right way: custom number formats that put a coloured up or down arrow next to a variance without changing the value, separate formats for measures where down is good, a dead band so tiny changes show as flat, a three-period trend indicator built with formulas, and a check of the displayed text with LibreOffice.",[41,12],"report-layouts",{"path":43,"title":44,"description":45,"type":46,"topics":47,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel","Applying Number and Date Formats in Excel","Format numbers, currency, percentages, and dates in Excel from Python with openpyxl number_format codes — display-only formatting that never alters the stored value.","guide",[12,35],{"path":49,"title":50,"description":51,"type":8,"topics":52,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fformat-dates-in-excel-cells-with-python","Format Dates in Excel Cells with Python","Format dates in Excel cells with openpyxl: write real datetime objects so Excel stores a date serial, then apply yyyy-mm-dd, mmm d yyyy, or dd\u002Fmm\u002Fyyyy display codes.",[12,35],{"path":54,"title":55,"description":56,"type":8,"topics":57,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fformat-durations-over-24-hours-in-excel","Format Durations Over 24 Hours in Excel with Python","Write time spent, machine run time or hours worked to Excel so 26 hours 30 minutes shows as 26:30, not 2:30 or 1. Understand how Excel stores durations, fix pandas timedelta columns that arrive formatted as whole days, use [h]:mm and [mm] formats, show decimal hours, total durations with formulas, and avoid negative-time errors.",[12,35],{"path":59,"title":60,"description":61,"type":8,"topics":62,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fformat-excel-cells-as-currency-with-python","Format Excel Cells as Currency with Python","Format Excel cells as currency with openpyxl: set $#,##0.00, apply it across a column, use €\u002F£ symbols, accounting parentheses for negatives, and post-process pandas output.",[12],{"path":64,"title":65,"description":66,"type":8,"topics":67,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fformat-fractions-and-scientific-notation-in-excel","Format Fractions and Scientific Notation in Excel","Control how Excel shows very small, very large and fractional numbers written from Python: fraction formats with up to one, two or three digit denominators or a fixed denominator such as sixteenths, scientific and engineering notation, why long numbers turn into 1.23457E+11 under the General format, and why IDs longer than 15 digits must be written as text.",[12],{"path":69,"title":70,"description":71,"type":8,"topics":72,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fformat-numbers-as-percentages-in-excel-with-python","Format Numbers as Percentages in Excel with Python","A percentage format multiplies by 100 on display, so store 0.125 not 12.5 — the format strings, the factor-of-100 trap, negatives in red, and writing percentages from pandas.",[12],{"path":74,"title":75,"description":76,"type":8,"topics":77,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fformat-numbers-in-lakhs-and-crores-in-excel","Format Numbers in Lakhs and Crores in Excel","Show amounts with Indian digit grouping — 12,34,56,789 instead of 123,456,789 — in Excel files generated with Python: a conditional number format that groups by lakh and crore on any computer, a matching format for negative numbers, the ₹ symbol and decimals, the limits of the approach above 100 crore, a Python formatter to check every case, and when to report in lakhs or crores instead.",[12],{"path":79,"title":80,"description":81,"type":8,"topics":82,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fformat-numbers-in-thousands-and-millions-in-excel","Format Numbers in Thousands and Millions in Excel with Python","Show 1,234,567 as 1,235K or 1.2M in an Excel report without changing the stored value — scaling commas in number formats, units in headers or suffixes, auto-switching K and M with conditional sections, negatives and small values, and totals that seem not to add up.",[12,83],"openpyxl",{"path":85,"title":86,"description":87,"type":8,"topics":88,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fformat-zip-codes-and-ids-with-leading-zeros","Format ZIP Codes and IDs with Leading Zeros in Excel","Write ZIP codes, employee numbers and account codes to Excel so 02134 stays 02134. Choose between storing them as text and storing numbers with a zero-padding format, write both ways with pandas, openpyxl and xlsxwriter, handle 5- and 9-digit ZIPs in one column, add prefixes and phone-style patterns, and avoid the lookup mismatches each choice can cause.",[12,89],"writing-excel",{"path":91,"title":92,"description":93,"type":8,"topics":94,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Flocalise-an-excel-report-for-other-languages-and-locales","Localise an Excel Report for Other Languages and Locales","Produce one Excel report for readers in Germany, France and Poland without breaking it: let number formats follow each reader's separators, use the locale-aware short date, pin month names to a language with LCID tags, place currency symbols, translate labels from one table, set right-to-left sheets, and check the result under each locale.",[12,41],{"path":96,"title":97,"description":98,"type":8,"topics":99,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fread-cell-values-as-displayed-in-excel","Read Cell Values as Displayed in Excel with Python","openpyxl and pandas return the stored value — 1234.5 — not the text Excel shows, such as (1,235) or 05\u002F03\u002F2026. Get the displayed text two ways — exported by LibreOffice, or formatted in Python by a small function that handles common number and date codes — and check them against each other.",[12,100,83],"reading-excel",{"path":102,"title":103,"description":104,"type":8,"topics":105,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fshow-negative-numbers-in-red-with-parentheses","Show Negative Numbers in Red with Parentheses in Excel","Format negatives the way finance readers expect — (1,235) in red, aligned with the positives above them — from Python with openpyxl or XlsxWriter. Covers the _) alignment trick, zero as a dash, currency and accounting layouts, reversed colours for costs, the \"(0)\" trap and parsing parentheses back into numbers.",[12,83],{"path":107,"title":108,"description":109,"type":8,"topics":110,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fshow-units-like-kg-or-hours-with-number-formats","Show Units Like kg or Hours with Number Formats","Display units such as kg, t, h, °C, m² or pcs next to numbers in an Excel report while the cells stay real numbers that sum, sort and chart: number format codes with quoted unit text, a column-to-unit mapping applied from pandas, kilograms shown as tonnes with the thousands scaling comma, singular and plural with conditions, and the displayed text checked in LibreOffice.",[12],{"path":112,"title":113,"description":114,"type":8,"topics":115,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fshow-zeros-as-dashes-or-hide-them-in-excel","Show Zeros as Dashes or Hide Them in Excel","Make zero values in a generated Excel report less noisy without changing the data: show them as a dash with the zero section of a number format, hide them in chosen cells or across a whole sheet, keep dashes aligned with the numbers around them, and understand how displayed dashes, hidden zeros, empty strings and true blanks behave in totals, averages and charts.",[12],{"path":117,"title":118,"description":119,"type":8,"topics":120,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fwrite-custom-number-format-codes-in-excel-with-python","Write Custom Number Format Codes in Excel with Python","The four-section format language explained: dashes for zero, red parenthesised negatives, thousands scaling with a trailing comma, literal units — all without changing the stored value.",[12,89],{"path":122,"title":123,"description":124,"type":8,"topics":125,"kind":13},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fbuilding-excel-reports-with-xlsxwriter\u002Fwrite-dates-times-and-durations-with-xlsxwriter","Write Dates, Times and Durations with XlsxWriter","Write dates, times and durations to Excel correctly with XlsxWriter: why a date written without a format appears as 46297, setting a default date format, handling the timezone error by converting before stripping, durations over 24 hours with [h]:mm, times of day, dates before 1900, and the same settings through pandas' ExcelWriter.",[126,12],"xlsxwriter",{"path":128,"title":129,"description":130,"type":8,"topics":131,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-hash-marks-showing-instead-of-values-in-excel","Fix #### Showing Instead of Values in Excel Output","Numbers and dates written from Python show as ##### in Excel when the column is too narrow for the formatted value, and negative dates and times always show that way in Excel. Set widths from the formatted text, use xlsxwriter's autofit, shrink to fit where space is fixed, and check the result by rendering the sheet.",[132,12],"troubleshooting",{"path":134,"title":135,"description":136,"type":8,"topics":137,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-long-id-numbers-losing-digits-in-excel","Fix Long ID Numbers Losing Digits or Turning into 1.23E+18 in Excel","Account numbers, card numbers and 18-digit IDs lose their last digits when written to Excel as numbers — Python writers keep 16 significant digits and Excel keeps 15. Write identifiers as text, read them back as text, and stop the leading zeros and trailing digits from changing.",[132,89,12],{"path":139,"title":140,"description":141,"type":8,"topics":142,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Ftroubleshooting-common-python-excel-errors\u002Ffix-number-stored-as-text-warnings-in-excel-output","Fix \"Number Stored as Text\" Warnings in Excel Output","Green triangles all over a workbook your script wrote mean numbers went in as strings. Convert them to real numbers before writing, keep identifiers as text on purpose, and silence the warning where text is correct.",[132,12,89],{"path":144,"title":145,"description":146,"type":8,"topics":147,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fwriting-dataframes-to-excel-with-pandas\u002Fround-numbers-for-excel-output-float-format-vs-number-formats","Round Numbers for Excel Output: float_format vs Number Formats","pandas offers three ways to get two decimal places into Excel — to_excel's float_format, DataFrame.round and a cell number format — and they do different things. See which one changes the stored value, which one changes only the display, and why they disagree on halves like 0.015.",[89,12,11],{"path":149,"title":150,"description":151,"type":8,"topics":152,"kind":13},"\u002Fgetting-started-with-python-excel-automation\u002Fwriting-dataframes-to-excel-with-pandas\u002Fwrite-dates-without-time-from-pandas-to-excel","Write Dates Without the Time Part from pandas to Excel","pandas writes datetime columns with a YYYY-MM-DD HH:MM:SS format, so every date shows 00:00:00. Write real dates that display as dates: convert to date objects, set datetime_format on an xlsxwriter ExcelWriter, or apply a number format per column — and avoid the openpyxl engine option that is silently ignored.",[89,35,12],1790972052271]