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)
対散布図からデータを抽出
- pandas DataFrameと、散布図にしたいカラム名を引数にしてSearchFromPlotを起動します引数x,yには数値(int, float)型のカラムのみ指定可能です
import sfplot search_result_df = sfplot.scatter(iris_dataset, x='sepal_length', y='sepal_width')
- ウィンドウが起動します
- 取得したいデータの範囲をドラッグします
- 「4件取得」と書かれたボタンを押下すると、ウィンドウが閉じ、選択範囲内のレコードを抽出したDataFrameを返却します
search_result_df
- 一度に複数回範囲を選択することも可能です
箱ひげ図からデータを抽出
- pandas DataFrameと、箱ひげ図にしたいカラム名を引数にしてSearchFromPlotを起動します引数xにはobject型のカラム、引数yには数値(int, float)型のカラムのみ指定可能です
search_result_df = sfplot.boxplot(iris_dataset, x='species', y='sepal_width')
- ウィンドウが起動します
操作方法は対散布図と同様です
Project details
Release history Release notifications | RSS feed
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)
Built Distribution
sfplot-0.0.1-py3-none-any.whl
(9.0 kB
view hashes)