[{"data":1,"prerenderedAt":2545},["ShallowReactive",2],{"doc:\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-text-function-equivalent-in-pandas":3,"surround:\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-text-function-equivalent-in-pandas":2512,"ancestors:\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-text-function-equivalent-in-pandas":2520,"children:\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-text-function-equivalent-in-pandas":2525,"related:\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-text-function-equivalent-in-pandas":2526},{"id":4,"title":5,"body":6,"dateModified":2478,"datePublished":2478,"description":2479,"extension":2480,"faq":2481,"keyword":2490,"kind":2491,"meta":2492,"navigation":318,"path":2500,"seo":2501,"slug":2504,"stem":2505,"topics":2506,"type":2510,"__hash__":2511},"docs\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-text-function-equivalent-in-pandas\u002Findex.md","Excel TEXT Function Equivalent in pandas",{"type":7,"value":8,"toc":2464},"minimark",[9,42,229,234,262,271,275,290,483,513,517,524,748,797,816,1012,1025,1029,1086,1197,1231,1396,1400,1406,1515,1547,1696,1715,1719,1725,1942,1959,1963,1969,2134,2145,2280,2283,2287,2347,2351,2360,2364,2391,2395,2401,2411,2417,2427,2431,2460],[10,11,12,13,17,18,21,22,21,25,28,29,31,32,35,36,41],"p",{},"Excel's ",[14,15,16],"code",{},"TEXT"," function turns a value into formatted text: ",[14,19,20],{},"=TEXT(A2, \"#,##0.00\")",", ",[14,23,24],{},"=TEXT(B2, \"0.0%\")",[14,26,27],{},"=TEXT(C2, \"mmm yyyy\")",". It is how people build labels such as \"North: 1,234.50 (12.3%)\", file names such as \"Sales Mar 2026.xlsx\", and sentences in report emails. pandas has no ",[14,30,16],{}," function, but Python's format specifications and ",[14,33,34],{},"strftime"," do the same job, column-wide. The translation is mostly mechanical, with one difference that matters when numbers must match a workbook exactly: rounding. This page, part of ",[37,38,40],"a",{"href":39},"\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002F","Excel Formula Equivalents in pandas",", maps the common format codes and fixes the rounding.",[43,44,52,53,52,57,52,61,52,69,52,77,52,84,52,91,52,94,52,98,52,103,52,109,52,111,52,116,52,118,52,121,52,124,52,128,52,130,52,134,52,136,52,139,52,142,52,146,52,148,52,152,52,154,52,157,52,160,52,164,52,166,52,170,52,172,52,175,52,178,52,182,52,184,52,188,52,190,52,193,52,196,52,200,52,202,52,206,52,208,52,211,52,214,52,218,52,220,52,224,52,226],"svg",{"viewBox":45,"role":46,"ariaLabelledBy":47,"xmlns":50,"style":51},"4 0 752 310","img",[48,49],"txt-codes-t","txt-codes-d","http:\u002F\u002Fwww.w3.org\u002F2000\u002Fsvg","width:100%;max-width:752px;height:auto;display:block;margin:1.5rem auto;font-family:Inter,ui-sans-serif,system-ui,sans-serif","\n  ",[54,55,56],"title",{"id":48},"TEXT format codes and their Python equivalents",[58,59,60],"desc",{"id":49},"A reference table of Excel TEXT format codes with the text they produce and the matching Python format. #,##0.00 gives 1,234.50 with :,.2f. 0.0% gives 12.3% with :.1%. 00000 gives 00042 with :05d. #,##0.0,, \"M\" gives 1.2M by dividing by a million first. yyyy-mm-dd gives 2026-03-01 with strftime %Y-%m-%d. mmm yyyy gives Mar 2026 with %b %Y. dddd gives Sunday with %A.",[62,63],"rect",{"x":64,"y":65,"width":66,"height":67,"fill":68},"4","0","752","310","#ffffff",[62,70],{"x":71,"y":72,"width":73,"height":74,"rx":65,"fill":68,"stroke":75,"style":76},"20.0","16.0","145.1","40.0","var(--line,#cdd5e6)","stroke-width:1px",[62,78],{"x":79,"y":72,"width":80,"height":74,"rx":65,"fill":81,"stroke":82,"style":83},"165.1","287.4","#f0f4ff","var(--brand,#5b5cf0)","stroke-width:1.2px",[85,86,90],"text",{"x":87,"y":88,"style":89},"308.8","41.0","font-size:13px;font-weight:700;fill:var(--brand-strong,#4338ca);text-anchor:middle","Excel TEXT result",[62,92],{"x":93,"y":72,"width":80,"height":74,"rx":65,"fill":81,"stroke":82,"style":83},"452.6",[85,95,97],{"x":96,"y":88,"style":89},"596.3","Python",[62,99],{"x":71,"y":100,"width":73,"height":101,"rx":65,"fill":102,"stroke":75,"style":76},"56.0","34.0","#e7ebef",[85,104,108],{"x":105,"y":106,"style":107},"32.0","78.0","font-size:12.5px;font-weight:700;fill:var(--text,#172033);text-anchor:start","\"#,##0.00\"",[62,110],{"x":79,"y":100,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,112,115],{"x":87,"y":113,"style":114},"77.0","font-size:11.5px;font-weight:400;fill:var(--text,#172033);text-anchor:middle","1,234.50",[62,117],{"x":93,"y":100,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,119,120],{"x":96,"y":113,"style":114},"f\"{v:,.2f}\"",[62,122],{"x":71,"y":123,"width":73,"height":101,"rx":65,"fill":102,"stroke":75,"style":76},"90.0",[85,125,127],{"x":105,"y":126,"style":107},"112.0","\"0.0%\"",[62,129],{"x":79,"y":123,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,131,133],{"x":87,"y":132,"style":114},"111.0","12.3%",[62,135],{"x":93,"y":123,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,137,138],{"x":96,"y":132,"style":114},"f\"{v:.1%}\"",[62,140],{"x":71,"y":141,"width":73,"height":101,"rx":65,"fill":102,"stroke":75,"style":76},"124.0",[85,143,145],{"x":105,"y":144,"style":107},"146.0","\"00000\"",[62,147],{"x":79,"y":141,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,149,151],{"x":87,"y":150,"style":114},"145.0","00042",[62,153],{"x":93,"y":141,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,155,156],{"x":96,"y":150,"style":114},"f\"{v:05d}\"",[62,158],{"x":71,"y":159,"width":73,"height":101,"rx":65,"fill":102,"stroke":75,"style":76},"158.0",[85,161,163],{"x":105,"y":162,"style":107},"180.0","\"#,##0.0,,\" + \"M\"",[62,165],{"x":79,"y":159,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,167,169],{"x":87,"y":168,"style":114},"179.0","1.2M",[62,171],{"x":93,"y":159,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,173,174],{"x":96,"y":168,"style":114},"f\"{v \u002F 1e6:,.1f}M\"",[62,176],{"x":71,"y":177,"width":73,"height":101,"rx":65,"fill":102,"stroke":75,"style":76},"192.0",[85,179,181],{"x":105,"y":180,"style":107},"214.0","\"yyyy-mm-dd\"",[62,183],{"x":79,"y":177,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,185,187],{"x":87,"y":186,"style":114},"213.0","2026-03-01",[62,189],{"x":93,"y":177,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,191,192],{"x":96,"y":186,"style":114},"dt.strftime(\"%Y-%m-%d\")",[62,194],{"x":71,"y":195,"width":73,"height":101,"rx":65,"fill":102,"stroke":75,"style":76},"226.0",[85,197,199],{"x":105,"y":198,"style":107},"248.0","\"mmm yyyy\"",[62,201],{"x":79,"y":195,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,203,205],{"x":87,"y":204,"style":114},"247.0","Mar 2026",[62,207],{"x":93,"y":195,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,209,210],{"x":96,"y":204,"style":114},"dt.strftime(\"%b %Y\")",[62,212],{"x":71,"y":213,"width":73,"height":101,"rx":65,"fill":102,"stroke":75,"style":76},"260.0",[85,215,217],{"x":105,"y":216,"style":107},"282.0","\"dddd\"",[62,219],{"x":79,"y":213,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,221,223],{"x":87,"y":222,"style":114},"281.0","Sunday",[62,225],{"x":93,"y":213,"width":80,"height":101,"rx":65,"fill":68,"stroke":75,"style":76},[85,227,228],{"x":96,"y":222,"style":114},"dt.strftime(\"%A\")",[230,231,233],"h2",{"id":232},"prerequisites","Prerequisites",[235,236,241],"pre",{"className":237,"code":238,"language":239,"meta":240,"style":240},"language-bash shiki shiki-themes github-light github-dark-high-contrast","pip install pandas openpyxl\n","bash","",[14,242,243],{"__ignoreMap":240},[244,245,248,252,256,259],"span",{"class":246,"line":247},"line",1,[244,249,251],{"class":250},"sMTad","pip",[244,253,255],{"class":254},"srMev"," install",[244,257,258],{"class":254}," pandas",[244,260,261],{"class":254}," openpyxl\n",[10,263,264,267,268,270],{},[14,265,266],{},"summary.xlsx"," has three regions with revenue (including a negative), a growth rate, a store number and a period-end date. The Excel results quoted below were produced by entering the same ",[14,269,16],{}," formulas and recalculating the workbook in LibreOffice.",[230,272,274],{"id":273},"step-1-numbers-with-separators-and-decimals","Step 1 — Numbers with separators and decimals",[10,276,277,278,281,282,285,286,289],{},"Python's format specification mini-language covers Excel's common number codes. ",[14,279,280],{},","," adds thousands separators, ",[14,283,284],{},".2f"," fixes two decimals, ",[14,287,288],{},"%"," multiplies by 100 and adds a percent sign:",[235,291,295],{"className":292,"code":293,"language":294,"meta":240,"style":240},"language-python shiki shiki-themes github-light github-dark-high-contrast","import pandas as pd\n\ns = pd.read_excel(\"summary.xlsx\")\ns[\"revenue_txt\"] = s[\"revenue\"].map(\"{:,.2f}\".format)\ns[\"growth_txt\"] = s[\"growth\"].map(\"{:.1%}\".format)\ns[\"store_txt\"] = s[\"store_no\"].map(\"{:05d}\".format)\nprint(s[[\"region\", \"revenue_txt\", \"growth_txt\", \"store_txt\"]].to_string(index=False))\n","python",[14,296,297,313,320,338,379,411,443],{"__ignoreMap":240},[244,298,299,303,307,310],{"class":246,"line":247},[244,300,302],{"class":301},"s-kum","import",[244,304,306],{"class":305},"skGVy"," pandas ",[244,308,309],{"class":301},"as",[244,311,312],{"class":305}," pd\n",[244,314,316],{"class":246,"line":315},2,[244,317,319],{"emptyLinePlaceholder":318},true,"\n",[244,321,323,326,329,332,335],{"class":246,"line":322},3,[244,324,325],{"class":305},"s ",[244,327,328],{"class":301},"=",[244,330,331],{"class":305}," pd.read_excel(",[244,333,334],{"class":254},"\"summary.xlsx\"",[244,336,337],{"class":305},")\n",[244,339,341,344,347,350,352,355,358,361,364,368,371,374,376],{"class":246,"line":340},4,[244,342,343],{"class":305},"s[",[244,345,346],{"class":254},"\"revenue_txt\"",[244,348,349],{"class":305},"] ",[244,351,328],{"class":301},[244,353,354],{"class":305}," s[",[244,356,357],{"class":254},"\"revenue\"",[244,359,360],{"class":305},"].map(",[244,362,363],{"class":254},"\"",[244,365,367],{"class":366},"sSjpA","{",[244,369,370],{"class":301},":,.2f",[244,372,373],{"class":366},"}",[244,375,363],{"class":254},[244,377,378],{"class":305},".format)\n",[244,380,382,384,387,389,391,393,396,398,400,402,405,407,409],{"class":246,"line":381},5,[244,383,343],{"class":305},[244,385,386],{"class":254},"\"growth_txt\"",[244,388,349],{"class":305},[244,390,328],{"class":301},[244,392,354],{"class":305},[244,394,395],{"class":254},"\"growth\"",[244,397,360],{"class":305},[244,399,363],{"class":254},[244,401,367],{"class":366},[244,403,404],{"class":301},":.1%",[244,406,373],{"class":366},[244,408,363],{"class":254},[244,410,378],{"class":305},[244,412,414,416,419,421,423,425,428,430,432,434,437,439,441],{"class":246,"line":413},6,[244,415,343],{"class":305},[244,417,418],{"class":254},"\"store_txt\"",[244,420,349],{"class":305},[244,422,328],{"class":301},[244,424,354],{"class":305},[244,426,427],{"class":254},"\"store_no\"",[244,429,360],{"class":305},[244,431,363],{"class":254},[244,433,367],{"class":366},[244,435,436],{"class":301},":05d",[244,438,373],{"class":366},[244,440,363],{"class":254},[244,442,378],{"class":305},[244,444,446,450,453,456,458,460,462,464,466,468,471,475,477,480],{"class":246,"line":445},7,[244,447,449],{"class":448},"sP0c6","print",[244,451,452],{"class":305},"(s[[",[244,454,455],{"class":254},"\"region\"",[244,457,21],{"class":305},[244,459,346],{"class":254},[244,461,21],{"class":305},[244,463,386],{"class":254},[244,465,21],{"class":305},[244,467,418],{"class":254},[244,469,470],{"class":305},"]].to_string(",[244,472,474],{"class":473},"sa561","index",[244,476,328],{"class":301},[244,478,479],{"class":448},"False",[244,481,482],{"class":305},"))\n",[10,484,485,488,489,492,493,496,497,492,499,502,503,505,506,508,509,512],{},[14,486,487],{},"\"{:,.2f}\".format"," is the column-wide form of ",[14,490,491],{},"=TEXT(B2,\"#,##0.00\")","; ",[14,494,495],{},"\"{:.1%}\""," matches ",[14,498,127],{},[14,500,501],{},"\"{:05d}\""," pads to five digits like ",[14,504,145],{},", turning store 42 into ",[14,507,151],{},". For a single value an f-string reads more naturally: ",[14,510,511],{},"f\"{revenue:,.2f}\"",".",[230,514,516],{"id":515},"step-2-signs-brackets-and-scaled-units","Step 2 — Signs, brackets and scaled units",[10,518,519,520,523],{},"Excel format codes can have separate sections for positive and negative numbers — ",[14,521,522],{},"\"#,##0.00;(#,##0.00)\""," puts negatives in brackets — and trailing commas scale by thousands. Python has no sections, so write the rule as a small function:",[235,525,527],{"className":292,"code":526,"language":294,"meta":240,"style":240},"def accounting(v):\n    return f\"({abs(v):,.2f})\" if v \u003C 0 else f\"{v:,.2f}\"\n\ndef millions(v):\n    return f\"{v \u002F 1_000_000:,.1f}M\"\n\ns[\"revenue_acct\"] = s[\"revenue\"].map(accounting)\ns[\"growth_signed\"] = s[\"growth\"].map(\"{:+.1%}\".format)\nprint(s[[\"region\", \"revenue_acct\", \"growth_signed\"]].to_string(index=False))\nprint([millions(v) for v in (1_234_567, 987_654_321)])\n",[14,528,529,541,598,602,611,638,642,660,691,718],{"__ignoreMap":240},[244,530,531,534,538],{"class":246,"line":247},[244,532,533],{"class":301},"def",[244,535,537],{"class":536},"s_Opv"," accounting",[244,539,540],{"class":305},"(v):\n",[244,542,543,546,549,552,554,557,560,562,564,567,570,573,576,579,582,584,586,588,591,593,595],{"class":246,"line":315},[244,544,545],{"class":301},"    return",[244,547,548],{"class":301}," f",[244,550,551],{"class":254},"\"(",[244,553,367],{"class":366},[244,555,556],{"class":448},"abs",[244,558,559],{"class":305},"(v)",[244,561,370],{"class":301},[244,563,373],{"class":366},[244,565,566],{"class":254},")\"",[244,568,569],{"class":301}," if",[244,571,572],{"class":305}," v ",[244,574,575],{"class":301},"\u003C",[244,577,578],{"class":448}," 0",[244,580,581],{"class":301}," else",[244,583,548],{"class":301},[244,585,363],{"class":254},[244,587,367],{"class":366},[244,589,590],{"class":305},"v",[244,592,370],{"class":301},[244,594,373],{"class":366},[244,596,597],{"class":254},"\"\n",[244,599,600],{"class":246,"line":322},[244,601,319],{"emptyLinePlaceholder":318},[244,603,604,606,609],{"class":246,"line":340},[244,605,533],{"class":301},[244,607,608],{"class":536}," millions",[244,610,540],{"class":305},[244,612,613,615,617,619,621,624,627,630,633,635],{"class":246,"line":381},[244,614,545],{"class":301},[244,616,548],{"class":301},[244,618,363],{"class":254},[244,620,367],{"class":366},[244,622,623],{"class":305},"v ",[244,625,626],{"class":301},"\u002F",[244,628,629],{"class":448}," 1_000_000",[244,631,632],{"class":301},":,.1f",[244,634,373],{"class":366},[244,636,637],{"class":254},"M\"\n",[244,639,640],{"class":246,"line":413},[244,641,319],{"emptyLinePlaceholder":318},[244,643,644,646,649,651,653,655,657],{"class":246,"line":445},[244,645,343],{"class":305},[244,647,648],{"class":254},"\"revenue_acct\"",[244,650,349],{"class":305},[244,652,328],{"class":301},[244,654,354],{"class":305},[244,656,357],{"class":254},[244,658,659],{"class":305},"].map(accounting)\n",[244,661,663,665,668,670,672,674,676,678,680,682,685,687,689],{"class":246,"line":662},8,[244,664,343],{"class":305},[244,666,667],{"class":254},"\"growth_signed\"",[244,669,349],{"class":305},[244,671,328],{"class":301},[244,673,354],{"class":305},[244,675,395],{"class":254},[244,677,360],{"class":305},[244,679,363],{"class":254},[244,681,367],{"class":366},[244,683,684],{"class":301},":+.1%",[244,686,373],{"class":366},[244,688,363],{"class":254},[244,690,378],{"class":305},[244,692,694,696,698,700,702,704,706,708,710,712,714,716],{"class":246,"line":693},9,[244,695,449],{"class":448},[244,697,452],{"class":305},[244,699,455],{"class":254},[244,701,21],{"class":305},[244,703,648],{"class":254},[244,705,21],{"class":305},[244,707,667],{"class":254},[244,709,470],{"class":305},[244,711,474],{"class":473},[244,713,328],{"class":301},[244,715,479],{"class":448},[244,717,482],{"class":305},[244,719,721,723,726,729,731,734,737,740,742,745],{"class":246,"line":720},10,[244,722,449],{"class":448},[244,724,725],{"class":305},"([millions(v) ",[244,727,728],{"class":301},"for",[244,730,572],{"class":305},[244,732,733],{"class":301},"in",[244,735,736],{"class":305}," (",[244,738,739],{"class":448},"1_234_567",[244,741,21],{"class":305},[244,743,744],{"class":448},"987_654_321",[244,746,747],{"class":305},")])\n",[10,749,750,753,754,757,758,761,762,765,766,768,769,772,773,776,777,780,781,784,785,788,789,792,793,796],{},[14,751,752],{},"accounting"," gives ",[14,755,756],{},"(1,234.50)"," for East, as Excel's two-section code does; ",[14,759,760],{},"millions"," reproduces ",[14,763,764],{},"\"#,##0.0,,\"M\"\""," by dividing first, giving ",[14,767,169],{}," and ",[14,770,771],{},"987.7M",". The ",[14,774,775],{},"+"," flag in ",[14,778,779],{},"\"{:+.1%}\""," shows the sign on positive values too — ",[14,782,783],{},"+12.3%"," — which Excel spells as ",[14,786,787],{},"\"+0.0%;-0.0%\"",". A zero growth becomes ",[14,790,791],{},"+0.0%","; if it should read ",[14,794,795],{},"0.0%",", handle zero explicitly in a function.",[10,798,799,800,803,804,807,808,811,812,815],{},"Excel codes can also have a third section for zero — ",[14,801,802],{},"\"#,##0.00;(#,##0.00);–\""," shows a dash instead of ",[14,805,806],{},"0.00"," — and missing values need a rule too, because formatting ",[14,809,810],{},"NaN"," produces the text ",[14,813,814],{},"\"nan\"",". Fold both into the same function:",[235,817,819],{"className":292,"code":818,"language":294,"meta":240,"style":240},"import math\n\ndef money(v, zero=\"–\", missing=\"\"):\n    if v is None or (isinstance(v, float) and math.isnan(v)):\n        return missing\n    if v == 0:\n        return zero\n    return f\"({abs(v):,.2f})\" if v \u003C 0 else f\"{v:,.2f}\"\n\nprint([money(v) for v in (1234.5, -1234.5, 0, float(\"nan\"))])\n",[14,820,821,828,832,858,894,902,916,923,967,971],{"__ignoreMap":240},[244,822,823,825],{"class":246,"line":247},[244,824,302],{"class":301},[244,826,827],{"class":305}," math\n",[244,829,830],{"class":246,"line":315},[244,831,319],{"emptyLinePlaceholder":318},[244,833,834,836,839,842,844,847,850,852,855],{"class":246,"line":322},[244,835,533],{"class":301},[244,837,838],{"class":536}," money",[244,840,841],{"class":305},"(v, zero",[244,843,328],{"class":301},[244,845,846],{"class":254},"\"–\"",[244,848,849],{"class":305},", missing",[244,851,328],{"class":301},[244,853,854],{"class":254},"\"\"",[244,856,857],{"class":305},"):\n",[244,859,860,863,865,868,871,874,876,879,882,885,888,891],{"class":246,"line":340},[244,861,862],{"class":301},"    if",[244,864,572],{"class":305},[244,866,867],{"class":301},"is",[244,869,870],{"class":448}," None",[244,872,873],{"class":301}," or",[244,875,736],{"class":305},[244,877,878],{"class":448},"isinstance",[244,880,881],{"class":305},"(v, ",[244,883,884],{"class":448},"float",[244,886,887],{"class":305},") ",[244,889,890],{"class":301},"and",[244,892,893],{"class":305}," math.isnan(v)):\n",[244,895,896,899],{"class":246,"line":381},[244,897,898],{"class":301},"        return",[244,900,901],{"class":305}," missing\n",[244,903,904,906,908,911,913],{"class":246,"line":413},[244,905,862],{"class":301},[244,907,572],{"class":305},[244,909,910],{"class":301},"==",[244,912,578],{"class":448},[244,914,915],{"class":305},":\n",[244,917,918,920],{"class":246,"line":445},[244,919,898],{"class":301},[244,921,922],{"class":305}," zero\n",[244,924,925,927,929,931,933,935,937,939,941,943,945,947,949,951,953,955,957,959,961,963,965],{"class":246,"line":662},[244,926,545],{"class":301},[244,928,548],{"class":301},[244,930,551],{"class":254},[244,932,367],{"class":366},[244,934,556],{"class":448},[244,936,559],{"class":305},[244,938,370],{"class":301},[244,940,373],{"class":366},[244,942,566],{"class":254},[244,944,569],{"class":301},[244,946,572],{"class":305},[244,948,575],{"class":301},[244,950,578],{"class":448},[244,952,581],{"class":301},[244,954,548],{"class":301},[244,956,363],{"class":254},[244,958,367],{"class":366},[244,960,590],{"class":305},[244,962,370],{"class":301},[244,964,373],{"class":366},[244,966,597],{"class":254},[244,968,969],{"class":246,"line":693},[244,970,319],{"emptyLinePlaceholder":318},[244,972,973,975,978,980,982,984,986,989,991,994,996,998,1000,1002,1004,1007,1009],{"class":246,"line":720},[244,974,449],{"class":448},[244,976,977],{"class":305},"([money(v) ",[244,979,728],{"class":301},[244,981,572],{"class":305},[244,983,733],{"class":301},[244,985,736],{"class":305},[244,987,988],{"class":448},"1234.5",[244,990,21],{"class":305},[244,992,993],{"class":301},"-",[244,995,988],{"class":448},[244,997,21],{"class":305},[244,999,65],{"class":448},[244,1001,21],{"class":305},[244,1003,884],{"class":448},[244,1005,1006],{"class":305},"(",[244,1008,814],{"class":254},[244,1010,1011],{"class":305},"))])\n",[10,1013,1014,1015,21,1018,21,1021,1024],{},"Keeping the rules in one function per kind of figure — ",[14,1016,1017],{},"money",[14,1019,1020],{},"pct",[14,1022,1023],{},"count"," — means every label in a report formats the same way, and a change of convention (a dash for zero, brackets for negatives) is made once.",[230,1026,1028],{"id":1027},"step-3-dates-and-times-with-strftime","Step 3 — Dates and times with strftime",[10,1030,1031,1032,1034,1035,1038,1039,21,1042,1038,1045,21,1048,1038,1051,21,1054,1038,1057,21,1060,1038,1063,21,1066,1038,1069,21,1072,1038,1075,1078,1079,1038,1082,1085],{},"Date codes map onto ",[14,1033,34],{}," directives: ",[14,1036,1037],{},"yyyy"," is ",[14,1040,1041],{},"%Y",[14,1043,1044],{},"mm",[14,1046,1047],{},"%m",[14,1049,1050],{},"dd",[14,1052,1053],{},"%d",[14,1055,1056],{},"mmm",[14,1058,1059],{},"%b",[14,1061,1062],{},"mmmm",[14,1064,1065],{},"%B",[14,1067,1068],{},"ddd",[14,1070,1071],{},"%a",[14,1073,1074],{},"dddd",[14,1076,1077],{},"%A",", and ",[14,1080,1081],{},"hh:mm",[14,1083,1084],{},"%H:%M",":",[235,1087,1089],{"className":292,"code":1088,"language":294,"meta":240,"style":240},"s[\"iso\"] = s[\"period_end\"].dt.strftime(\"%Y-%m-%d\")\ns[\"month_label\"] = s[\"period_end\"].dt.strftime(\"%b %Y\")\ns[\"weekday\"] = s[\"period_end\"].dt.strftime(\"%A\")\nprint(s[[\"period_end\", \"iso\", \"month_label\", \"weekday\"]].to_string(index=False))\n",[14,1090,1091,1119,1145,1167],{"__ignoreMap":240},[244,1092,1093,1095,1098,1100,1102,1104,1107,1110,1113,1115,1117],{"class":246,"line":247},[244,1094,343],{"class":305},[244,1096,1097],{"class":254},"\"iso\"",[244,1099,349],{"class":305},[244,1101,328],{"class":301},[244,1103,354],{"class":305},[244,1105,1106],{"class":254},"\"period_end\"",[244,1108,1109],{"class":305},"].dt.strftime(",[244,1111,1112],{"class":254},"\"%Y-%m-",[244,1114,1053],{"class":366},[244,1116,363],{"class":254},[244,1118,337],{"class":305},[244,1120,1121,1123,1126,1128,1130,1132,1134,1136,1138,1140,1143],{"class":246,"line":315},[244,1122,343],{"class":305},[244,1124,1125],{"class":254},"\"month_label\"",[244,1127,349],{"class":305},[244,1129,328],{"class":301},[244,1131,354],{"class":305},[244,1133,1106],{"class":254},[244,1135,1109],{"class":305},[244,1137,363],{"class":254},[244,1139,1059],{"class":366},[244,1141,1142],{"class":254}," %Y\"",[244,1144,337],{"class":305},[244,1146,1147,1149,1152,1154,1156,1158,1160,1162,1165],{"class":246,"line":322},[244,1148,343],{"class":305},[244,1150,1151],{"class":254},"\"weekday\"",[244,1153,349],{"class":305},[244,1155,328],{"class":301},[244,1157,354],{"class":305},[244,1159,1106],{"class":254},[244,1161,1109],{"class":305},[244,1163,1164],{"class":254},"\"%A\"",[244,1166,337],{"class":305},[244,1168,1169,1171,1173,1175,1177,1179,1181,1183,1185,1187,1189,1191,1193,1195],{"class":246,"line":340},[244,1170,449],{"class":448},[244,1172,452],{"class":305},[244,1174,1106],{"class":254},[244,1176,21],{"class":305},[244,1178,1097],{"class":254},[244,1180,21],{"class":305},[244,1182,1125],{"class":254},[244,1184,21],{"class":305},[244,1186,1151],{"class":254},[244,1188,470],{"class":305},[244,1190,474],{"class":473},[244,1192,328],{"class":301},[244,1194,479],{"class":448},[244,1196,482],{"class":305},[10,1198,1199,1200,1202,1203,1207,1208,1211,1212,1215,1216,1218,1219,1222,1223,1226,1227,1230],{},"The one to watch is ",[14,1201,1044],{},". In Excel it means ",[1204,1205,1206],"em",{},"month"," in a date code but ",[1204,1209,1210],{},"minutes"," after ",[14,1213,1214],{},"hh","; in Python ",[14,1217,1047],{}," is always the month and ",[14,1220,1221],{},"%M"," always minutes, so ",[14,1224,1225],{},"\"hh:mm\""," becomes ",[14,1228,1229],{},"\"%H:%M\"",". Month and day names come from the machine's locale, which is English on most servers; a report for French readers either maps the names itself or runs with a French locale set.",[43,1232,52,1238,52,1241,52,1244,52,1249,52,1253,52,1257,52,1263,52,1267,52,1272,52,1274,52,1278,52,1281,52,1284,52,1286,52,1289,52,1292,52,1296,52,1299,52,1302,52,1306,52,1308,52,1311,52,1313,52,1315,52,1317,52,1320,52,1322,52,1324,52,1326,52,1329,52,1331,52,1333,52,1336,52,1340,52,1342,52,1345,52,1347,52,1349,52,1352,52,1355,52,1357,52,1359,52,1361,52,1363,52,1369,52,1372,52,1378,52,1383,52,1390],{"viewBox":1233,"role":46,"ariaLabelledBy":1234,"xmlns":50,"style":1237},"99 0 562 192",[1235,1236],"txt-dates-t","txt-dates-d","width:100%;max-width:562px;height:auto;display:block;margin:1.5rem auto;font-family:Inter,ui-sans-serif,system-ui,sans-serif",[54,1239,1240],{"id":1235},"One date, formatted three ways",[58,1242,1243],{"id":1236},"Left: the date 2026-03-01 stored as a real date. Right: the same date formatted as text with strftime: 2026-03-01 for %Y-%m-%d, Mar 2026 for %b %Y, and Sunday for %A.",[62,1245],{"x":1246,"y":65,"width":1247,"height":1248,"fill":68},"99","562","192",[62,1250],{"x":1251,"y":74,"width":105,"height":1252,"rx":65,"fill":102,"stroke":75,"style":76},"115.2","24.0",[62,1254],{"x":1255,"y":74,"width":1256,"height":1252,"rx":65,"fill":102,"stroke":75,"style":76},"147.2","98.9",[85,1258,1262],{"x":1259,"y":1260,"style":1261},"196.7","57.0","font-size:11px;font-weight:600;fill:var(--muted,#5b6780);text-anchor:middle","A",[62,1264],{"x":1251,"y":1265,"width":105,"height":1266,"rx":65,"fill":102,"stroke":75,"style":76},"64.0","28.0",[85,1268,1271],{"x":1269,"y":1270,"style":1261},"131.2","83.0","1",[62,1273],{"x":1255,"y":1265,"width":1256,"height":1266,"rx":65,"fill":68,"stroke":75,"style":76},[85,1275,1277],{"x":1259,"y":1270,"style":1276},"font-size:12px;font-weight:700;fill:var(--text,#172033);text-anchor:middle","period_end",[62,1279],{"x":1251,"y":1280,"width":105,"height":1266,"rx":65,"fill":102,"stroke":75,"style":76},"92.0",[85,1282,1283],{"x":1269,"y":132,"style":1261},"2",[62,1285],{"x":1255,"y":1280,"width":1256,"height":1266,"rx":65,"fill":68,"stroke":75,"style":76},[85,1287,187],{"x":1259,"y":132,"style":1288},"font-size:12px;font-weight:400;fill:var(--text,#172033);text-anchor:middle",[62,1290],{"x":1291,"y":74,"width":105,"height":1252,"rx":65,"fill":102,"stroke":75,"style":76},"411.1",[62,1293],{"x":1294,"y":74,"width":1295,"height":1252,"rx":65,"fill":102,"stroke":75,"style":76},"443.1","102.9",[85,1297,1262],{"x":1298,"y":1260,"style":1261},"494.5",[62,1300],{"x":1301,"y":74,"width":1256,"height":1252,"rx":65,"fill":102,"stroke":75,"style":76},"545.9",[85,1303,1305],{"x":1304,"y":1260,"style":1261},"595.3","B",[62,1307],{"x":1291,"y":1265,"width":105,"height":1266,"rx":65,"fill":102,"stroke":75,"style":76},[85,1309,1271],{"x":1310,"y":1270,"style":1261},"427.1",[62,1312],{"x":1294,"y":1265,"width":1295,"height":1266,"rx":65,"fill":68,"stroke":75,"style":76},[85,1314,14],{"x":1298,"y":1270,"style":1276},[62,1316],{"x":1301,"y":1265,"width":1256,"height":1266,"rx":65,"fill":68,"stroke":75,"style":76},[85,1318,1319],{"x":1304,"y":1270,"style":1276},"result",[62,1321],{"x":1291,"y":1280,"width":105,"height":1266,"rx":65,"fill":102,"stroke":75,"style":76},[85,1323,1283],{"x":1310,"y":132,"style":1261},[62,1325],{"x":1294,"y":1280,"width":1295,"height":1266,"rx":65,"fill":68,"stroke":75,"style":76},[85,1327,1328],{"x":1298,"y":132,"style":1288},"%Y-%m-%d",[62,1330],{"x":1301,"y":1280,"width":1256,"height":1266,"rx":65,"fill":68,"stroke":75,"style":76},[85,1332,187],{"x":1304,"y":132,"style":1288},[62,1334],{"x":1291,"y":1335,"width":105,"height":1266,"rx":65,"fill":102,"stroke":75,"style":76},"120.0",[85,1337,1339],{"x":1310,"y":1338,"style":1261},"139.0","3",[62,1341],{"x":1294,"y":1335,"width":1295,"height":1266,"rx":65,"fill":68,"stroke":75,"style":76},[85,1343,1344],{"x":1298,"y":1338,"style":1288},"%b %Y",[62,1346],{"x":1301,"y":1335,"width":1256,"height":1266,"rx":65,"fill":68,"stroke":75,"style":76},[85,1348,205],{"x":1304,"y":1338,"style":1288},[62,1350],{"x":1291,"y":1351,"width":105,"height":1266,"rx":65,"fill":102,"stroke":75,"style":76},"148.0",[85,1353,64],{"x":1310,"y":1354,"style":1261},"167.0",[62,1356],{"x":1294,"y":1351,"width":1295,"height":1266,"rx":65,"fill":68,"stroke":75,"style":76},[85,1358,1077],{"x":1298,"y":1354,"style":1288},[62,1360],{"x":1301,"y":1351,"width":1256,"height":1266,"rx":65,"fill":68,"stroke":75,"style":76},[85,1362,223],{"x":1304,"y":1354,"style":1288},[85,1364,1368],{"x":1365,"y":1366,"style":1367},"180.7","29.0","font-size:12.5px;font-weight:700;fill:var(--muted,#5b6780);text-anchor:middle","period_end (date)",[85,1370,85],{"x":1371,"y":1366,"style":1367},"527.9",[246,1373],{"x1":1374,"y1":1375,"x2":1376,"y2":1375,"stroke":82,"style":1377},"256.1","80.0","397.1","stroke-width:2px",[1379,1380],"polygon",{"points":1381,"fill":1382},"401.1,80.0 392.1,85.0 392.1,75.0","#5b5cf0",[62,1384],{"x":1385,"y":1386,"width":1387,"height":1388,"rx":1389,"fill":68,"stroke":75,"style":83},"278.6","47.0","100.0","22.0","11",[85,1391,1395],{"x":1392,"y":1393,"style":1394},"328.6","62.0","font-size:11.5px;font-weight:400;fill:var(--brand-strong,#4338ca);text-anchor:middle;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace","dt.strftime",[230,1397,1399],{"id":1398},"step-4-match-excels-rounding","Step 4 — Match Excel's rounding",[10,1401,1402,1403,1405],{},"Here is where a straight translation can disagree with the workbook. ",[14,1404,16],{}," rounds halves away from zero; Python's formatting rounds the binary value half to even:",[235,1407,1409],{"className":292,"code":1408,"language":294,"meta":240,"style":240},"excel = {1234.5: \"1,235\", 2.5: \"3\", 3.5: \"4\"}          # TEXT(v, \"#,##0\") after recalculation\nfor v, shown in excel.items():\n    print(f\"{v}: Excel {shown!r}  Python {v:,.0f}\")\n",[14,1410,1411,1456,1468],{"__ignoreMap":240},[244,1412,1413,1416,1418,1421,1423,1426,1429,1431,1434,1436,1439,1441,1444,1446,1449,1452],{"class":246,"line":247},[244,1414,1415],{"class":305},"excel ",[244,1417,328],{"class":301},[244,1419,1420],{"class":305}," {",[244,1422,988],{"class":448},[244,1424,1425],{"class":305},": ",[244,1427,1428],{"class":254},"\"1,235\"",[244,1430,21],{"class":305},[244,1432,1433],{"class":448},"2.5",[244,1435,1425],{"class":305},[244,1437,1438],{"class":254},"\"3\"",[244,1440,21],{"class":305},[244,1442,1443],{"class":448},"3.5",[244,1445,1425],{"class":305},[244,1447,1448],{"class":254},"\"4\"",[244,1450,1451],{"class":305},"}          ",[244,1453,1455],{"class":1454},"s-wDw","# TEXT(v, \"#,##0\") after recalculation\n",[244,1457,1458,1460,1463,1465],{"class":246,"line":315},[244,1459,728],{"class":301},[244,1461,1462],{"class":305}," v, shown ",[244,1464,733],{"class":301},[244,1466,1467],{"class":305}," excel.items():\n",[244,1469,1470,1473,1475,1478,1480,1482,1484,1486,1489,1491,1494,1497,1499,1502,1504,1506,1509,1511,1513],{"class":246,"line":322},[244,1471,1472],{"class":448},"    print",[244,1474,1006],{"class":305},[244,1476,1477],{"class":301},"f",[244,1479,363],{"class":254},[244,1481,367],{"class":366},[244,1483,590],{"class":305},[244,1485,373],{"class":366},[244,1487,1488],{"class":254},": Excel ",[244,1490,367],{"class":366},[244,1492,1493],{"class":305},"shown",[244,1495,1496],{"class":301},"!r",[244,1498,373],{"class":366},[244,1500,1501],{"class":254},"  Python ",[244,1503,367],{"class":366},[244,1505,590],{"class":305},[244,1507,1508],{"class":301},":,.0f",[244,1510,373],{"class":366},[244,1512,363],{"class":254},[244,1514,337],{"class":305},[10,1516,1517,1518,753,1521,21,1524,753,1527,768,1529,753,1532,1534,1535,21,1538,768,1540,1542,1543,1546],{},"Recalculated in LibreOffice, ",[14,1519,1520],{},"TEXT(1234.5, \"#,##0\")",[14,1522,1523],{},"1,235",[14,1525,1526],{},"TEXT(2.5, \"0\")",[14,1528,1339],{},[14,1530,1531],{},"TEXT(3.5, \"0\")",[14,1533,64],{},". Python gives ",[14,1536,1537],{},"1,234",[14,1539,1283],{},[14,1541,64],{},": 2.5 and 1234.5 round down to the even neighbour. When the text must match numbers readers see in Excel, round with ",[14,1544,1545],{},"decimal"," first, then format:",[235,1548,1550],{"className":292,"code":1549,"language":294,"meta":240,"style":240},"from decimal import Decimal, ROUND_HALF_UP\n\ndef text_like_excel(v, decimals=0):\n    q = Decimal(str(v)).quantize(Decimal(1).scaleb(-decimals), rounding=ROUND_HALF_UP)\n    return f\"{q:,.{decimals}f}\"\n\nprint([text_like_excel(v) for v in (1234.5, 2.5, 3.5)], text_like_excel(987654.321, 2))\n",[14,1551,1552,1568,1572,1588,1624,1655,1659],{"__ignoreMap":240},[244,1553,1554,1557,1560,1562,1565],{"class":246,"line":247},[244,1555,1556],{"class":301},"from",[244,1558,1559],{"class":305}," decimal ",[244,1561,302],{"class":301},[244,1563,1564],{"class":305}," Decimal, ",[244,1566,1567],{"class":448},"ROUND_HALF_UP\n",[244,1569,1570],{"class":246,"line":315},[244,1571,319],{"emptyLinePlaceholder":318},[244,1573,1574,1576,1579,1582,1584,1586],{"class":246,"line":322},[244,1575,533],{"class":301},[244,1577,1578],{"class":536}," text_like_excel",[244,1580,1581],{"class":305},"(v, decimals",[244,1583,328],{"class":301},[244,1585,65],{"class":448},[244,1587,857],{"class":305},[244,1589,1590,1593,1595,1598,1601,1604,1606,1609,1611,1614,1617,1619,1622],{"class":246,"line":340},[244,1591,1592],{"class":305},"    q ",[244,1594,328],{"class":301},[244,1596,1597],{"class":305}," Decimal(",[244,1599,1600],{"class":448},"str",[244,1602,1603],{"class":305},"(v)).quantize(Decimal(",[244,1605,1271],{"class":448},[244,1607,1608],{"class":305},").scaleb(",[244,1610,993],{"class":301},[244,1612,1613],{"class":305},"decimals), ",[244,1615,1616],{"class":473},"rounding",[244,1618,328],{"class":301},[244,1620,1621],{"class":448},"ROUND_HALF_UP",[244,1623,337],{"class":305},[244,1625,1626,1628,1630,1632,1634,1637,1640,1642,1644,1647,1649,1651,1653],{"class":246,"line":381},[244,1627,545],{"class":301},[244,1629,548],{"class":301},[244,1631,363],{"class":254},[244,1633,367],{"class":366},[244,1635,1636],{"class":305},"q",[244,1638,1639],{"class":301},":,",[244,1641,512],{"class":305},[244,1643,367],{"class":366},[244,1645,1646],{"class":305},"decimals",[244,1648,373],{"class":366},[244,1650,1477],{"class":301},[244,1652,373],{"class":366},[244,1654,597],{"class":254},[244,1656,1657],{"class":246,"line":413},[244,1658,319],{"emptyLinePlaceholder":318},[244,1660,1661,1663,1666,1668,1670,1672,1674,1676,1678,1680,1682,1684,1687,1690,1692,1694],{"class":246,"line":445},[244,1662,449],{"class":448},[244,1664,1665],{"class":305},"([text_like_excel(v) ",[244,1667,728],{"class":301},[244,1669,572],{"class":305},[244,1671,733],{"class":301},[244,1673,736],{"class":305},[244,1675,988],{"class":448},[244,1677,21],{"class":305},[244,1679,1433],{"class":448},[244,1681,21],{"class":305},[244,1683,1443],{"class":448},[244,1685,1686],{"class":305},")], text_like_excel(",[244,1688,1689],{"class":448},"987654.321",[244,1691,21],{"class":305},[244,1693,1283],{"class":448},[244,1695,482],{"class":305},[10,1697,1698,1699,21,1701,768,1703,1705,1706,1709,1710,1714],{},"Now the results are ",[14,1700,1523],{},[14,1702,1339],{},[14,1704,64],{},", matching Excel. ",[14,1707,1708],{},"Decimal(str(v))"," uses the value as it is written rather than its binary approximation, which also fixes cases like 2.675 that sit just below the half in binary. ",[37,1711,1713],{"href":1712},"\u002Fgetting-started-with-python-excel-automation\u002Fwriting-dataframes-to-excel-with-pandas\u002Fround-numbers-for-excel-output-float-format-vs-number-formats\u002F","Round Numbers for Excel Output: float_format vs Number Formats"," covers the same rounding question for numbers written to cells.",[230,1716,1718],{"id":1717},"step-5-build-labels-file-names-and-sentences","Step 5 — Build labels, file names and sentences",[10,1720,1721,1722,1724],{},"The point of ",[14,1723,16],{}," is usually a larger string. Combine formatted pieces with f-strings, row by row where the label varies:",[235,1726,1728],{"className":292,"code":1727,"language":294,"meta":240,"style":240},"s[\"label\"] = [f\"{r}: {text_like_excel(v, 2)} ({g:+.1%})\" for r, v, g in zip(s[\"region\"], s[\"revenue\"], s[\"growth\"])]\nprint(s[\"label\"].tolist())\n\nperiod = s[\"period_end\"].max()\nfilename = f\"Sales {period:%b %Y}.xlsx\"\nsentence = f\"Revenue for the quarter ending {period:%d %B %Y} was {text_like_excel(s['revenue'].sum(), 2)}.\"\nprint(filename, \"|\", sentence)\n",[14,1729,1730,1810,1821,1825,1839,1871,1929],{"__ignoreMap":240},[244,1731,1732,1734,1737,1739,1741,1744,1746,1748,1750,1753,1755,1757,1759,1762,1764,1767,1769,1771,1773,1776,1778,1780,1782,1785,1788,1790,1793,1796,1798,1801,1803,1805,1807],{"class":246,"line":247},[244,1733,343],{"class":305},[244,1735,1736],{"class":254},"\"label\"",[244,1738,349],{"class":305},[244,1740,328],{"class":301},[244,1742,1743],{"class":305}," [",[244,1745,1477],{"class":301},[244,1747,363],{"class":254},[244,1749,367],{"class":366},[244,1751,1752],{"class":305},"r",[244,1754,373],{"class":366},[244,1756,1425],{"class":254},[244,1758,367],{"class":366},[244,1760,1761],{"class":305},"text_like_excel(v, ",[244,1763,1283],{"class":448},[244,1765,1766],{"class":305},")",[244,1768,373],{"class":366},[244,1770,736],{"class":254},[244,1772,367],{"class":366},[244,1774,1775],{"class":305},"g",[244,1777,684],{"class":301},[244,1779,373],{"class":366},[244,1781,566],{"class":254},[244,1783,1784],{"class":301}," for",[244,1786,1787],{"class":305}," r, v, g ",[244,1789,733],{"class":301},[244,1791,1792],{"class":448}," zip",[244,1794,1795],{"class":305},"(s[",[244,1797,455],{"class":254},[244,1799,1800],{"class":305},"], s[",[244,1802,357],{"class":254},[244,1804,1800],{"class":305},[244,1806,395],{"class":254},[244,1808,1809],{"class":305},"])]\n",[244,1811,1812,1814,1816,1818],{"class":246,"line":315},[244,1813,449],{"class":448},[244,1815,1795],{"class":305},[244,1817,1736],{"class":254},[244,1819,1820],{"class":305},"].tolist())\n",[244,1822,1823],{"class":246,"line":322},[244,1824,319],{"emptyLinePlaceholder":318},[244,1826,1827,1830,1832,1834,1836],{"class":246,"line":340},[244,1828,1829],{"class":305},"period ",[244,1831,328],{"class":301},[244,1833,354],{"class":305},[244,1835,1106],{"class":254},[244,1837,1838],{"class":305},"].max()\n",[244,1840,1841,1844,1846,1848,1851,1853,1856,1858,1861,1863,1866,1868],{"class":246,"line":381},[244,1842,1843],{"class":305},"filename ",[244,1845,328],{"class":301},[244,1847,548],{"class":301},[244,1849,1850],{"class":254},"\"Sales ",[244,1852,367],{"class":366},[244,1854,1855],{"class":305},"period:",[244,1857,288],{"class":301},[244,1859,1860],{"class":305},"b ",[244,1862,288],{"class":301},[244,1864,1865],{"class":305},"Y",[244,1867,373],{"class":366},[244,1869,1870],{"class":254},".xlsx\"\n",[244,1872,1873,1876,1878,1880,1883,1885,1888,1890,1892,1895,1897,1900,1902,1904,1906,1909,1911,1914,1917,1920,1922,1924,1926],{"class":246,"line":413},[244,1874,1875],{"class":305},"sentence ",[244,1877,328],{"class":301},[244,1879,548],{"class":301},[244,1881,1882],{"class":254},"\"Revenue for the quarter ending ",[244,1884,367],{"class":366},[244,1886,1887],{"class":305},"period",[244,1889,1085],{"class":301},[244,1891,288],{"class":305},[244,1893,1894],{"class":301},"d ",[244,1896,288],{"class":305},[244,1898,1899],{"class":301},"B ",[244,1901,288],{"class":305},[244,1903,1865],{"class":301},[244,1905,373],{"class":366},[244,1907,1908],{"class":254}," was ",[244,1910,367],{"class":366},[244,1912,1913],{"class":305},"text_like_excel(s[",[244,1915,1916],{"class":254},"'revenue'",[244,1918,1919],{"class":305},"].sum(), ",[244,1921,1283],{"class":448},[244,1923,1766],{"class":305},[244,1925,373],{"class":366},[244,1927,1928],{"class":254},".\"\n",[244,1930,1931,1933,1936,1939],{"class":246,"line":445},[244,1932,449],{"class":448},[244,1934,1935],{"class":305},"(filename, ",[244,1937,1938],{"class":254},"\"|\"",[244,1940,1941],{"class":305},", sentence)\n",[10,1943,1944,1945,1947,1948,1951,1952,1955,1956,1958],{},"f-strings accept the same format specs inline, including ",[14,1946,34],{}," codes for datetime values (",[14,1949,1950],{},"{period:%b %Y}","), which keeps the whole template readable in one place. A file name built from a date in ",[14,1953,1954],{},"%Y-%m"," order sorts chronologically in a folder listing; one built from ",[14,1957,1344],{}," reads better but sorts alphabetically — choose per use.",[230,1960,1962],{"id":1961},"step-6-do-not-put-text-where-numbers-belong","Step 6 — Do not put text where numbers belong",[10,1964,1965,1966,1968],{},"Formatted text looks like a number and behaves like text: it cannot be summed, it sorts character by character, and Excel shows its green \"number stored as text\" triangle. For cells in a report, write the numbers and set a number format; keep ",[14,1967,16],{},"-style strings for labels:",[235,1970,1972],{"className":292,"code":1971,"language":294,"meta":240,"style":240},"from openpyxl import load_workbook\n\ns[[\"region\", \"revenue\", \"growth\", \"label\"]].to_excel(\"report.xlsx\", index=False)\nwb = load_workbook(\"report.xlsx\")\nws = wb.active\nfor row in ws.iter_rows(min_row=2):\n    row[1].number_format = \"#,##0.00;(#,##0.00)\"\n    row[2].number_format = \"+0.0%;-0.0%;0.0%\"\nwb.save(\"report.xlsx\")\nprint([(c.value, c.number_format) for c in ws[2][:3]])\n",[14,1973,1974,1986,1990,2025,2039,2049,2070,2085,2098,2107],{"__ignoreMap":240},[244,1975,1976,1978,1981,1983],{"class":246,"line":247},[244,1977,1556],{"class":301},[244,1979,1980],{"class":305}," openpyxl ",[244,1982,302],{"class":301},[244,1984,1985],{"class":305}," load_workbook\n",[244,1987,1988],{"class":246,"line":315},[244,1989,319],{"emptyLinePlaceholder":318},[244,1991,1992,1995,1997,1999,2001,2003,2005,2007,2009,2012,2015,2017,2019,2021,2023],{"class":246,"line":322},[244,1993,1994],{"class":305},"s[[",[244,1996,455],{"class":254},[244,1998,21],{"class":305},[244,2000,357],{"class":254},[244,2002,21],{"class":305},[244,2004,395],{"class":254},[244,2006,21],{"class":305},[244,2008,1736],{"class":254},[244,2010,2011],{"class":305},"]].to_excel(",[244,2013,2014],{"class":254},"\"report.xlsx\"",[244,2016,21],{"class":305},[244,2018,474],{"class":473},[244,2020,328],{"class":301},[244,2022,479],{"class":448},[244,2024,337],{"class":305},[244,2026,2027,2030,2032,2035,2037],{"class":246,"line":340},[244,2028,2029],{"class":305},"wb ",[244,2031,328],{"class":301},[244,2033,2034],{"class":305}," load_workbook(",[244,2036,2014],{"class":254},[244,2038,337],{"class":305},[244,2040,2041,2044,2046],{"class":246,"line":381},[244,2042,2043],{"class":305},"ws ",[244,2045,328],{"class":301},[244,2047,2048],{"class":305}," wb.active\n",[244,2050,2051,2053,2056,2058,2061,2064,2066,2068],{"class":246,"line":413},[244,2052,728],{"class":301},[244,2054,2055],{"class":305}," row ",[244,2057,733],{"class":301},[244,2059,2060],{"class":305}," ws.iter_rows(",[244,2062,2063],{"class":473},"min_row",[244,2065,328],{"class":301},[244,2067,1283],{"class":448},[244,2069,857],{"class":305},[244,2071,2072,2075,2077,2080,2082],{"class":246,"line":445},[244,2073,2074],{"class":305},"    row[",[244,2076,1271],{"class":448},[244,2078,2079],{"class":305},"].number_format ",[244,2081,328],{"class":301},[244,2083,2084],{"class":254}," \"#,##0.00;(#,##0.00)\"\n",[244,2086,2087,2089,2091,2093,2095],{"class":246,"line":662},[244,2088,2074],{"class":305},[244,2090,1283],{"class":448},[244,2092,2079],{"class":305},[244,2094,328],{"class":301},[244,2096,2097],{"class":254}," \"+0.0%;-0.0%;0.0%\"\n",[244,2099,2100,2103,2105],{"class":246,"line":693},[244,2101,2102],{"class":305},"wb.save(",[244,2104,2014],{"class":254},[244,2106,337],{"class":305},[244,2108,2109,2111,2114,2116,2119,2121,2124,2126,2129,2131],{"class":246,"line":720},[244,2110,449],{"class":448},[244,2112,2113],{"class":305},"([(c.value, c.number_format) ",[244,2115,728],{"class":301},[244,2117,2118],{"class":305}," c ",[244,2120,733],{"class":301},[244,2122,2123],{"class":305}," ws[",[244,2125,1283],{"class":448},[244,2127,2128],{"class":305},"][:",[244,2130,1339],{"class":448},[244,2132,2133],{"class":305},"]])\n",[10,2135,2136,2137,2139,2140,2144],{},"The revenue cell still holds 1234.5 and displays ",[14,2138,115],{},"; the label column holds text for the chart or the email. ",[37,2141,2143],{"href":2142},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fwrite-custom-number-format-codes-in-excel-with-python\u002F","Write Custom Number Format Codes in Excel with Python"," covers the number-format side.",[43,2146,52,2151,52,2154,52,2157,52,2160,52,2167,52,2177,52,2182,52,2187,52,2192,52,2199,52,2203,52,2208,52,2212,52,2217,52,2221,52,2228,52,2232,52,2238,52,2243,52,2247,52,2251,52,2256,52,2259,52,2264,52,2267,52,2272,52,2275],{"viewBox":2147,"role":46,"ariaLabelledBy":2148,"xmlns":50,"style":51},"4 0 752 233",[2149,2150],"txt-cell-t","txt-cell-d",[54,2152,2153],{"id":2149},"A formatted string versus a number with a format",[58,2155,2156],{"id":2150},"Two panels about the same revenue figure in a cell. As text such as \"1,234.50\" it displays correctly but cannot be summed, sorts character by character and shows a number-stored-as-text warning. As the number 1234.5 with the format #,##0.00 it displays the same way, sums, sorts numerically and can be charted.",[62,2158],{"x":64,"y":65,"width":66,"height":2159,"fill":68},"233",[62,2161],{"x":71,"y":72,"width":2162,"height":2163,"rx":2164,"fill":2165,"stroke":2166,"style":1377},"351.0","201.0","14","#fee8f2","var(--accent,#f43f8f)",[1775,2168,2170],{"transform":2169},"translate(182.5,29.0) scale(1.083)",[2171,2172],"path",{"d":2173,"fill":2174,"stroke":2175,"style":2176},"M12 3.5l9.5 17h-19z M12 10v5 M12 17.8v.4","none","var(--accent-ink,#be185d)","stroke-width:1.66px;stroke-linecap:round;stroke-linejoin:round",[85,2178,2181],{"x":2179,"y":106,"style":2180},"195.5","font-size:14px;font-weight:700;fill:var(--accent-ink,#be185d);text-anchor:middle","Text \"1,234.50\"",[246,2183],{"x1":2184,"y1":2185,"x2":2186,"y2":2185,"stroke":2166,"style":76},"36.0","91.0","355.0",[85,2188,2191],{"x":2189,"y":132,"style":2190},"60.0","font-size:12px;font-weight:400;fill:var(--text,#172033);text-anchor:start","SUM ignores it",[1775,2193,2195],{"transform":2194},"translate(38.5,99.5) scale(0.625)",[2171,2196],{"d":2197,"fill":2174,"stroke":2166,"style":2198},"M6 6l12 12 M18 6L6 18","stroke-width:2.88px;stroke-linecap:round;stroke-linejoin:round",[85,2200,2202],{"x":2189,"y":2201,"style":2190},"137.0","sorts as text",[1775,2204,2206],{"transform":2205},"translate(38.5,125.5) scale(0.625)",[2171,2207],{"d":2197,"fill":2174,"stroke":2166,"style":2198},[85,2209,2211],{"x":2189,"y":2210,"style":2190},"163.0","green triangle warning",[1775,2213,2215],{"transform":2214},"translate(38.5,151.5) scale(0.625)",[2171,2216],{"d":2197,"fill":2174,"stroke":2166,"style":2198},[85,2218,2220],{"x":2189,"y":2219,"style":2190},"189.0","fine for labels and titles",[1775,2222,2224],{"transform":2223},"translate(38.5,177.5) scale(0.625)",[2171,2225],{"d":2226,"fill":2174,"stroke":2227,"style":2198},"M5 12.5l4.5 4.5L19 7","var(--teal,#0f9488)",[62,2229],{"x":2230,"y":72,"width":2162,"height":2163,"rx":2164,"fill":2231,"stroke":2227,"style":1377},"389.0","#d9f4f1",[1775,2233,2235],{"transform":2234},"translate(551.5,29.0) scale(1.083)",[2171,2236],{"d":2226,"fill":2174,"stroke":2237,"style":2176},"var(--teal-ink,#0b6157)",[85,2239,2242],{"x":2240,"y":106,"style":2241},"564.5","font-size:14px;font-weight:700;fill:var(--teal-ink,#0b6157);text-anchor:middle","Number + format #,##0.00",[246,2244],{"x1":2245,"y1":2185,"x2":2246,"y2":2185,"stroke":2227,"style":76},"405.0","724.0",[85,2248,2250],{"x":2249,"y":132,"style":2190},"429.0","same display",[1775,2252,2254],{"transform":2253},"translate(407.5,99.5) scale(0.625)",[2171,2255],{"d":2226,"fill":2174,"stroke":2227,"style":2198},[85,2257,2258],{"x":2249,"y":2201,"style":2190},"sums and sorts",[1775,2260,2262],{"transform":2261},"translate(407.5,125.5) scale(0.625)",[2171,2263],{"d":2226,"fill":2174,"stroke":2227,"style":2198},[85,2265,2266],{"x":2249,"y":2210,"style":2190},"charts correctly",[1775,2268,2270],{"transform":2269},"translate(407.5,151.5) scale(0.625)",[2171,2271],{"d":2226,"fill":2174,"stroke":2227,"style":2198},[85,2273,2274],{"x":2249,"y":2219,"style":2190},"right for data cells",[1775,2276,2278],{"transform":2277},"translate(407.5,177.5) scale(0.625)",[2171,2279],{"d":2226,"fill":2174,"stroke":2227,"style":2198},[10,2281,2282],{},"When a number must appear both ways — in a cell and in a chart title — write the number to the cell and build the title text from the same value with the functions above, so the two cannot drift apart.",[230,2284,2286],{"id":2285},"common-pitfalls","Common pitfalls",[2288,2289,2290,2298,2308,2322,2333],"ul",{},[2291,2292,2293,2297],"li",{},[2294,2295,2296],"strong",{},"Formatting numbers that will be calculated with."," Keep numbers numeric in cells; format only labels.",[2291,2299,2300,2303,2304,2307],{},[2294,2301,2302],{},"Python's half-even rounding."," Use ",[14,2305,2306],{},"decimal.ROUND_HALF_UP"," when text must match Excel.",[2291,2309,2310,2315,2316,2318,2319,2321],{},[2294,2311,2312,2314],{},[14,2313,1044],{}," versus minutes."," Python separates them: ",[14,2317,1047],{}," month, ",[14,2320,1221],{}," minutes.",[2291,2323,2324,2327,2328,768,2330,2332],{},[2294,2325,2326],{},"Locale-dependent names."," ",[14,2329,1059],{},[14,2331,1077],{}," follow the machine's locale, so the same job can produce \"Mar\" on one server and \"mars\" on another; set the locale explicitly or map names yourself for reports that must be identical everywhere.",[2291,2334,2335,2327,2338,753,2341,2343,2344,2346],{},[2294,2336,2337],{},"Format specs on missing values.",[14,2339,2340],{},"\"{:,.2f}\".format(nan)",[14,2342,814],{},"; handle ",[14,2345,810],{}," before formatting.",[230,2348,2350],{"id":2349},"performance-notes","Performance notes",[10,2352,2353,2356,2357,2359],{},[14,2354,2355],{},"map"," with a format string runs one Python call per value, about a million values per second — fine for labels and summaries. ",[14,2358,1395],{}," is vectorised and faster. For very large exports, formatting is almost never needed: write numbers and let number formats handle display.",[230,2361,2363],{"id":2362},"conclusion","Conclusion",[10,2365,12,2366,2369,2370,21,2372,21,2374,2376,2377,2379,2380,768,2382,2384,2385,2387,2388,2390],{},[14,2367,2368],{},"TEXT(value, code)"," becomes a Python format spec — ",[14,2371,120],{},[14,2373,138],{},[14,2375,156],{}," — or ",[14,2378,1395],{}," with directives such as ",[14,2381,1328],{},[14,2383,1344],{},", applied to columns with ",[14,2386,2355],{},". Write small functions for Excel's multi-section codes and scaled units, round with ",[14,2389,1621],{}," when the text must match Excel, build labels and file names with f-strings, and keep numbers as numbers wherever readers will calculate with them.",[230,2392,2394],{"id":2393},"frequently-asked-questions","Frequently asked questions",[10,2396,2397,2400],{},[2294,2398,2399],{},"When should I use TEXT-style formatting instead of a number format?","\nUse text only when the result is text by nature — a label, a file name, a sentence in an email, a chart title. For cells that readers may sort, sum or chart, keep the number and apply a number format instead.",[10,2402,2403,2406,2407,2410],{},[2294,2404,2405],{},"What replaces TEXT(A1, \"#,##0.00\")?","\nA Python format spec: f\"{value:,.2f}\", or df",[244,2408,2409],{},"\"col\"",".map(\"{:,.2f}\".format) for a whole column. The comma adds thousands separators and .2f fixes two decimals.",[10,2412,2413,2416],{},[2294,2414,2415],{},"Why does Python give 1,234 where Excel gives 1,235?","\nPython's formatting rounds halves to even and works on the binary value, while Excel's TEXT rounds halves away from zero. Round with decimal.ROUND_HALF_UP first when the text must match Excel.",[10,2418,2419,2422,2423,2426],{},[2294,2420,2421],{},"How do I format dates like TEXT(A1, \"mmm yyyy\")?","\nUse df",[244,2424,2425],{},"\"date\"",".dt.strftime(\"%b %Y\"). Excel's mmm becomes %b, yyyy becomes %Y, dddd becomes %A. Month and day names follow the machine's locale unless you map them yourself.",[230,2428,2430],{"id":2429},"related","Related",[2288,2432,2433,2439,2446,2453],{},[2291,2434,2435,2436,2438],{},"Up one level: ",[37,2437,40],{"href":39}," — every function, translated.",[2291,2440,2441,2445],{},[37,2442,2444],{"href":2443},"\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-text-functions-left-right-mid-and-concat-in-pandas\u002F","Excel Text Functions LEFT, RIGHT, MID and CONCAT in pandas"," — the other text functions.",[2291,2447,2448,2452],{},[37,2449,2451],{"href":2450},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fread-cell-values-as-displayed-in-excel\u002F","Read Cell Values as Displayed in Excel with Python"," — the reverse: displayed text from a workbook.",[2291,2454,2455,2459],{},[37,2456,2458],{"href":2457},"\u002Fformatting-and-charting-excel-reports-with-python\u002Fapplying-number-and-date-formats-in-excel\u002Fformat-numbers-in-thousands-and-millions-in-excel\u002F","Format Numbers in Thousands and Millions in Excel with Python"," — scaled units as number formats.",[2461,2462,2463],"style",{},"html pre.shiki code .sMTad, html code.shiki .sMTad{--shiki-default:#6F42C1;--shiki-dark:#FFB757}html pre.shiki code .srMev, html code.shiki .srMev{--shiki-default:#032F62;--shiki-dark:#ADDCFF}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 .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .s-kum, html code.shiki .s-kum{--shiki-default:#D73A49;--shiki-dark:#FF9492}html pre.shiki code .skGVy, html code.shiki .skGVy{--shiki-default:#24292E;--shiki-dark:#F0F3F6}html pre.shiki code .sSjpA, html code.shiki .sSjpA{--shiki-default:#005CC5;--shiki-dark:#FF9492}html pre.shiki code .sP0c6, html code.shiki .sP0c6{--shiki-default:#005CC5;--shiki-dark:#91CBFF}html pre.shiki code .sa561, html code.shiki .sa561{--shiki-default:#E36209;--shiki-dark:#FFB757}html pre.shiki code .s_Opv, html code.shiki .s_Opv{--shiki-default:#6F42C1;--shiki-dark:#DBB7FF}html pre.shiki code .s-wDw, html code.shiki .s-wDw{--shiki-default:#6A737D;--shiki-dark:#BDC4CC}",{"title":240,"searchDepth":315,"depth":315,"links":2465},[2466,2467,2468,2469,2470,2471,2472,2473,2474,2475,2476,2477],{"id":232,"depth":315,"text":233},{"id":273,"depth":315,"text":274},{"id":515,"depth":315,"text":516},{"id":1027,"depth":315,"text":1028},{"id":1398,"depth":315,"text":1399},{"id":1717,"depth":315,"text":1718},{"id":1961,"depth":315,"text":1962},{"id":2285,"depth":315,"text":2286},{"id":2349,"depth":315,"text":2350},{"id":2362,"depth":315,"text":2363},{"id":2393,"depth":315,"text":2394},{"id":2429,"depth":315,"text":2430},"2026-09-25","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\".","md",[2482,2484,2486,2488],{"q":2399,"a":2483},"Use text only when the result is text by nature — a label, a file name, a sentence in an email, a chart title. For cells that readers may sort, sum or chart, keep the number and apply a number format instead.",{"q":2405,"a":2485},"A Python format spec: f\"{value:,.2f}\", or df[\"col\"].map(\"{:,.2f}\".format) for a whole column. The comma adds thousands separators and .2f fixes two decimals.",{"q":2415,"a":2487},"Python's formatting rounds halves to even and works on the binary value, while Excel's TEXT rounds halves away from zero. Round with decimal.ROUND_HALF_UP first when the text must match Excel.",{"q":2421,"a":2489},"Use df[\"date\"].dt.strftime(\"%b %Y\"). Excel's mmm becomes %b, yyyy becomes %Y, dddd becomes %A. Month and day names follow the machine's locale unless you map them yourself.","excel text function equivalent format numbers as text in pandas",null,{"breadcrumb":2493},[2494,2496,2499],{"name":2495,"item":626},"Home",{"name":2497,"item":2498},"Advanced Data Transformation and Cleaning for Excel Automation","\u002Fadvanced-data-transformation-and-cleaning\u002F",{"name":40,"item":39},"\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-text-function-equivalent-in-pandas",{"title":2502,"description":2503},"Excel TEXT() in pandas: Format Numbers and Dates as Strings","Reproduce Excel TEXT(value, format) in pandas with f-string format specs and dt.strftime: thousands separators, percentages, leading zeros, millions, accounting negatives, month names, and matching Excel's half-up rounding.","excel-text-function-equivalent-in-pandas","advanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-text-function-equivalent-in-pandas\u002Findex",[2507,2508,2509],"formula-equivalents","number-formats","pandas","how-to","GyoYu0eb42sdHo5MamTjISZUDqI6_AbREnJZwFpk88w",[2513,2517],{"title":2514,"path":2515,"stem":2516,"children":-1},"Excel IF Formulas as pandas Conditional Columns","\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-if-formulas-as-pandas-conditional-columns","advanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-if-formulas-as-pandas-conditional-columns\u002Findex",{"title":2444,"path":2518,"stem":2519,"children":-1},"\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-text-functions-left-right-mid-and-concat-in-pandas","advanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas\u002Fexcel-text-functions-left-right-mid-and-concat-in-pandas\u002Findex",[2521,2523],{"path":2522,"title":40},"\u002Fadvanced-data-transformation-and-cleaning\u002Fexcel-formula-equivalents-in-pandas",{"path":2524,"title":2497},"\u002Fadvanced-data-transformation-and-cleaning",[],[2527,2530,2533,2536,2539,2542],{"path":2528,"title":2529,"kind":2510},"\u002Fadvanced-data-transformation-and-cleaning\u002Fmerging-and-joining-excel-dataframes\u002Fvlookup-equivalent-in-pandas-for-excel-files","The VLOOKUP Equivalent in pandas for Excel Files",{"path":2531,"title":2532,"kind":2510},"\u002Fadvanced-data-transformation-and-cleaning\u002Fcleaning-excel-data-with-pandas\u002Fextract-numbers-and-codes-from-text-with-pandas","Extract Numbers and Codes from Text with pandas",{"path":2534,"title":2535,"kind":2510},"\u002Fadvanced-data-transformation-and-cleaning\u002Fcleaning-excel-data-with-pandas\u002Fsplit-full-names-into-first-and-last-names-with-pandas","Split Full Names into First and Last Names with pandas",{"path":2537,"title":2538,"kind":2510},"\u002Fadvanced-data-transformation-and-cleaning\u002Fcreating-pivot-tables-from-excel-data\u002Fbin-values-into-ranges-with-pandas-cut","Bin Values into Ranges Like Excel FREQUENCY with pd.cut",{"path":2540,"title":2541,"kind":2510},"\u002Fadvanced-data-transformation-and-cleaning\u002Fcreating-pivot-tables-from-excel-data\u002Fcalculate-percent-of-total-per-group-in-pandas","Calculate Percent of Total per Group in pandas",{"path":2543,"title":2544,"kind":2510},"\u002Fadvanced-data-transformation-and-cleaning\u002Fcreating-pivot-tables-from-excel-data\u002Fcount-distinct-values-per-group-in-pandas","Count Distinct Values per Group in pandas",1790972086945]