<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<oembed>
  <author_name>HK29</author_name>
  <author_url>https://blog.hatena.ne.jp/HK29/</author_url>
  <blog_title>PythonとVBAで世の中を便利にする</blog_title>
  <blog_url>https://hk29.hatenablog.jp/</blog_url>
  <categories>
    <anon>Python</anon>
    <anon>pandas</anon>
    <anon>抽出</anon>
  </categories>
  <description>例題データは、機械学習でお馴染みのアイリスデータセットを用いました。150行×5列のデータです。 本記事でやりたいことは、例えば、sepal_lengthという列（カラム）に対して、5, 5.5, 6の値である行を全て抽出したい場合に適用し、次のようにします。リストの直前に@マークを付けることでリストと認識することがポイントです。 target_list = [5, 5.5, 6] df2 = df.query('sepal_length in @target_list') print(df2) 下図はその結果です。sepal_length列が5, 5.5, 6である行が全て一括で取得できるこ…</description>
  <height>190</height>
  <html>&lt;iframe src=&quot;https://hatenablog-parts.com/embed?url=https%3A%2F%2Fhk29.hatenablog.jp%2Fentry%2F2021%2F07%2F16%2F235822&quot; title=&quot;Python 指定列に対して、リスト内の値と一致する要素がある行を複数一括で抽出する「Pandasのquery」 - PythonとVBAで世の中を便利にする&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>https://cdn-ak.f.st-hatena.com/images/fotolife/H/HK29/20210716/20210716235539.png</image_url>
  <provider_name>Hatena Blog</provider_name>
  <provider_url>https://hatena.blog</provider_url>
  <published>2021-07-16 23:58:22</published>
  <title>Python 指定列に対して、リスト内の値と一致する要素がある行を複数一括で抽出する「Pandasのquery」</title>
  <type>rich</type>
  <url>https://hk29.hatenablog.jp/entry/2021/07/16/235822</url>
  <version>1.0</version>
  <width>100%</width>
</oembed>
