Skip to main content

Search records of pandas dataframe from plot.

Project description

概要

散布図または箱ひげ図からデータを抽出することができます
関数を呼び出すと、tkウィンドウが立ち上がります
ウィンドウに表示された図上をドラッグすることで範囲を指定でき、
範囲内にプロットされているデータをDataFrameで受け取ることができます

jupyter notebook上で使うことを想定しています

インストール

$ pip install sfplot

使い方

サンプルデータにirisデータセットを利用します

from sklearn.datasets import load_iris
import seaborn as sns
iris_dataset = sns.load_dataset('iris')
iris_dataset.head(10)

image0

対散布図からデータを抽出

  • pandas DataFrameと、散布図にしたいカラム名を引数にしてSearchFromPlotを起動します
    引数x,yには数値(int, float)型のカラムのみ指定可能です
    import sfplot
    search_result_df = sfplot.scatter(iris_dataset, x='sepal_length', y='sepal_width')
  • ウィンドウが起動します
    image1
  • 取得したいデータの範囲をドラッグします
    image2
  • 「4件取得」と書かれたボタンを押下すると、ウィンドウが閉じ、
    選択範囲内のレコードを抽出したDataFrameを返却します
    search_result_df

    image3

  • 一度に複数回範囲を選択することも可能です
    image4
    image5

箱ひげ図からデータを抽出

  • pandas DataFrameと、箱ひげ図にしたいカラム名を引数にしてSearchFromPlotを起動します
    引数xにはobject型のカラム、引数yには数値(int, float)型のカラムのみ指定可能です
    search_result_df = sfplot.boxplot(iris_dataset, x='species', y='sepal_width')
  • ウィンドウが起動します
    image6
  • 操作方法は対散布図と同様です

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sfplot-0.0.1.tar.gz (7.9 kB view hashes)

Uploaded Source

Built Distribution

sfplot-0.0.1-py3-none-any.whl (9.0 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page