Seaborn countplot- ဘားများကို နံပါတ်ဖြင့် မည်သို့မှာယူမည်နည်း။
Seaborn count chart တွင် ဘားများကို ကြီးစဉ်ငယ်လိုက် စီစစ်ရန်အတွက် အောက်ပါအခြေခံအထားအသိုကိုသုံးနိုင်သည်။
sns. countplot (data=df, x=' var ', order=df[' var ']. value_counts (). index )
ဘားများကို ငယ်စဉ်ကြီးလိုက် စီရန်၊ ရိုးရှင်းစွာ ကြီးစဉ်ကြီးလိုက်=အမှန် တန်ဖိုး_counts() လုပ်ဆောင်ချက်သို့ ထည့်ပါ-
sns. countplot (data=df, x=' var ', order=df[' var ']. value_counts (ascending= True ). index )
အောက်ဖော်ပြပါနမူနာများသည် အောက်ပါ pandas DataFrame နှင့် လက်တွေ့တွင် ဤ syntax ကိုမည်သို့အသုံးပြုရမည်ကို ပြသသည် ။
import pandas as pd #createDataFrame df = pd. DataFrame ({' team ': ['A', 'A', 'A', 'A', 'B', 'C', 'C', 'C', 'D', 'D'], ' points ': [12, 11, 18, 15, 14, 20, 25, 24, 32, 30]}) #view DataFrame print (df) team points 0 to 12 1 to 11 2 to 18 3 to 15 4 B 14 5 C 20 6 C 25 7 C 24 8 D 32 9 D 30
ဥပမာ 1- ပုံသေအမှာစာတွင် ဘားများဖြင့် Seaborn Count Plot တစ်ခုကို ဖန်တီးပါ။
အောက်ဖော်ပြပါ ကုဒ်သည် ဘားများသည် ပုံသေအစီအစတွင် ရှိနေသည့် Seaborn အကောင့်ကို ဖန်တီးနည်းကို ပြသသည် (ဆိုလိုသည်မှာ၊ ကော်လံတွင် ထူးခြားသောတန်ဖိုးများပေါ်လာသည့် အစီအစဥ်ဖြစ်သည်)။
import seaborn as sns
#create countplot to visualize occurrences of unique values in 'team' column
sns. countplot (data=df, x=' team ')
အဖွဲ့ကော်လံတွင် ထူးခြားသောတန်ဖိုးများပေါ်လာသည့်အစီအစဥ်အပေါ် အခြေခံ၍ ကွက်ကွက်ရှိဘားများကို ရိုးရိုးရှင်းရှင်း စီထားခြင်းဖြစ်သည်ကို သတိပြုပါ။
ဥပမာ 2- ကြီးစဉ်ငယ်လိုက် ဘားများဖြင့် Seaborn Count Plot တစ်ခုကို ဖန်တီးပါ။
အောက်ဖော်ပြပါ ကုဒ်သည် ဘားများကို ကြီးစဉ်ငယ်လိုက် စီထားသော Seaborn count plot ဖန်တီးနည်းကို ပြသည်-
import seaborn as sns #create countplot with values in descending order sns. countplot (data=df, x=' team ', order=df[' team ']. value_counts (). index )
ယခု ဇာတ်ကွက်ရှိ ဘားများသည် ကြီးစဉ်ငယ်လိုက် ဖြစ်နေကြောင်း သတိပြုပါ။
ဥပမာ 3- Ascending Order ဘားများဖြင့် Seaborn Count Plot ကိုဖန်တီးပါ။
အောက်ဖော်ပြပါ ကုဒ်သည် ဘားများကို ငယ်စဉ်ကြီးလိုက် စီစဉ်သည့် Seaborn count chart ကို ဖန်တီးနည်းကို ပြသည်-
import seaborn as sns #create countplot with values in ascending order sns. countplot (data=df, x=' team ', order=df[' team ']. value_counts (ascending= True ). index )
ယခု ဇာတ်ကွက်ရှိ ဘားများသည် ကြီးစဉ်ငယ်လိုက် ဖြစ်နေကြောင်း သတိပြုပါ။
မှတ်ချက် – seaborn countplot() လုပ်ဆောင်ချက်အတွက် စာရွက်စာတမ်းအပြည့်အစုံကို ဤနေရာတွင် ရှာဖွေနိုင်ပါသည်။
ထပ်လောင်းအရင်းအမြစ်များ
အောက်ဖော်ပြပါ သင်ခန်းစာများသည် ပင်လယ်မွေးတွင် အခြားဘုံလုပ်ဆောင်ချက်များကို မည်သို့လုပ်ဆောင်ရမည်ကို ရှင်းပြသည်-
Seaborn တွင် ဖြန့်ချီပုံဆွဲနည်း
Seaborn ရှိ x-axis ပေါ်ရှိ boxplot များကို မည်သို့မှာယူမည်နည်း။
Seaborn ဇာတ်ကွက်တွင် ဇယားတစ်ခုထည့်နည်း