pythonのseleniumとbs4で以下のようなデータ取得し、dataframeに格納しています。
python
1 0 20 #ContentsBox 31 / 42 http://online.s-bin/search/sea... 53 /sitemap/index.html 64 n/faq/index.html 7.. ... 8295 ../profile/13064.htm 9296 ../profile/13077.htm 10297 /menseki/index.html 11298 /nese/tumon/index.html 12299
そこから、「../profile/~」を含むデータだけ抽出し、新たにdataframeを作りたいと思っています。
そこで、以下のコードを作りました。
python
1dftest = df[df_link[0].str.contains('profile',na=False)]
ところが、実行したところ、以下のメッセージが出てきて新しいdataframeにはデータが収納できていませんでした。
python
1 UserWarning: Boolean Series key will be reindexed to match DataFrame index. 2 dftest = df[df_link[0].str.contains('profile',na=False)] 3Empty DataFrame 4Columns: [0] 5Index: []
このエラー(メッセージ)について、サイトで調べてみましたが、参考・該当する事例が見つけられなかったので、どのように回避すればよいか、あるいはこの知識を使えばよいよというレベル感でも大丈夫ですので、ご教授いただけると助かります。
よろしくお願いします。
回答3件
あなたの回答
tips
プレビュー