<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>anton0825</author_name>
  <author_url>https://blog.hatena.ne.jp/anton0825/</author_url>
  <blog_title>日々精進</blog_title>
  <blog_url>https://anton0825.hatenablog.com/</blog_url>
  <categories>
    <anon>AI</anon>
  </categories>
  <description>以下のように、移動平均などを計算しようとしたらすごく時間がかかっていたので速くしようとした時の話。 agg = sales[SALES_COUNT].astype(&quot;float32&quot;).shift(shift).rolling(window) \ .agg([&quot;mean&quot;, &quot;max&quot;, &quot;min&quot;, &quot;std&quot;, lambda x: x.mode()[0]]) \ .reset_index().set_index(&quot;seq_idx&quot;) #2.3秒かかった ↑を↓のように書き換え、最頻値を計算しないようにしたら150倍ぐらい速くなった（！） agg = sales[SALES_COUNT].a…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fanton0825.hatenablog.com%2Fentry%2F2017%2F11%2F18%2F000000&quot; title=&quot;Pandasで最頻値を計算する処理は非常に重い - 日々精進&quot; class=&quot;embed-card embed-blogcard&quot; scrolling=&quot;no&quot; frameborder=&quot;0&quot; style=&quot;display: block; width: 100%; height: 190px; max-width: 500px; margin: 10px 0px;&quot;&gt;&lt;/iframe&gt;</html>
  <image_url></image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2017-11-18 00:00:00</published>
  <title>Pandasで最頻値を計算する処理は非常に重い</title>
  <type>rich</type>
  <url>https://anton0825.hatenablog.com/entry/2017/11/18/000000</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
