<rss xmlns:atom="http://www.w3.org/2005/Atom" version="2.0">
  <channel>
    <title>Pandas - 标签 - William</title>
    <link>https://williamlfang.github.io/tags/pandas/</link>
    <description>Pandas - 标签 | William</description>
    <generator>Hugo -- gohugo.io</generator><language>zh-CN</language><lastBuildDate>Thu, 15 Oct 2026 11:20:12 &#43;0900</lastBuildDate><atom:link href="https://williamlfang.github.io/tags/pandas/" rel="self" type="application/rss+xml" /><item>
  <title>Logging a full pandas DataFrame from an f-string: rebuild it from the caller&#39;s source</title>
  <link>https://williamlfang.github.io/2026-10-15-log-full-dataframe-from-fstring/</link>
  <pubDate>Thu, 15 Oct 2026 11:20:12 &#43;0900</pubDate>
  <author>william</author>
  <guid>https://williamlfang.github.io/2026-10-15-log-full-dataframe-from-fstring/</guid>
  <description><![CDATA[<p>A daily script of mine logs its intermediate DataFrames with
<code>log.crt(f&quot;&quot;&quot;...{tgt = }...&quot;&quot;&quot;)</code>. The log showed 10 of the 90 rows, with the
header stuck to the end of <code>tgt = </code>. Switching to <code>tgt.to_string()</code> printed every
row, but the header ended up two columns left of the data.</p>
<p>The fix I ended up with keeps the f-string as it is and adds one argument:
<code>log.crt(f&quot;...{tgt = }...&quot;, full=True)</code>. That looks impossible, because the
f-string is already built when the logger runs. The logger gets around it by
finding the f-string in the caller&rsquo;s source and evaluating it a second time.</p>]]></description>
</item>
</channel>
</rss>
