<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>data1</author_name>
  <author_url>https://blog.hatena.ne.jp/data1/</author_url>
  <blog_title>yk’s diary</blog_title>
  <blog_url>https://data1.hatenablog.com/</blog_url>
  <categories>
  </categories>
  <description>pandas.DataFrameに対してSQLのcase whenと同じことをして、新しい列を作る方法がはいくつかあるようなので、まとめておく。 元データ import pandas as pd import numpy as np df=pd.DataFrame({'fruit':['Strawberry','Apple', 'Peach', 'Banana', 'grapes']}) df fruit 0 Strawberry 1 Apple 2 Peach 3 Banana 4 grapes 上記が元データで、下記の「果物」という新しい列を加えたdataftameにしたい fruit 果…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fdata1.hatenablog.com%2Fentry%2F2023%2F07%2F08%2F153043&quot; title=&quot;SQLのcase whenと同じことをpandas.DataFrameに対して行う - yk’s diary&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>2023-07-08 15:30:43</published>
  <title>SQLのcase whenと同じことをpandas.DataFrameに対して行う</title>
  <type>rich</type>
  <url>https://data1.hatenablog.com/entry/2023/07/08/153043</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
