Pandas- dataframe တွင် ကော်လံတစ်ခုစီအတွက် ဟီစတိုဂရမ်တစ်ခုကို ဖန်တီးပါ။


Pandas DataFrame ကော်လံတစ်ခုစီအတွက် histogram တစ်ခုကို ဖန်တီးရန် အောက်ပါအခြေခံ syntax ကို သင်အသုံးပြုနိုင်ပါသည်။

 import pandas as pd
import matplotlib. pyplot as plt

#define number of subplots
fig, axis = plt. subplots (1, 3)

#create histogram for each column in DataFrame
df. hist (ax=axis)

ဤဥပမာသည် DataFrame တွင် ကော်လံ 3 ခု ရှိကြောင်း သတ်မှတ်ရန် subplots() function ကိုအသုံးပြုပြီး ကော်လံတစ်ခုစီအတွက် histogram တစ်ခုဖန်တီးပေးသည်။

အောက်ဖော်ပြပါ ဥပမာသည် ဤ syntax ကို လက်တွေ့တွင် မည်သို့အသုံးပြုရမည်ကို ပြသထားသည်။

ဥပမာ- Pandas histogram ရှိ ကော်လံတစ်ခုစီအတွက် ဟီစတိုဂရမ်တစ်ခု ဖန်တီးပါ။

ကျွန်ုပ်တို့တွင် ကော်လံသုံးခုပါရှိသော အောက်ပါပန်ဒါ DataFrame ရှိသည်ဆိုပါစို့။

 import pandas as pd
import numpy as np

#make this example reproducible
n.p. random . seeds (1)

#createDataFrame
df = pd. DataFrame ({' points ': np. random . normal (loc=20, scale=2, size=300),
                   ' assists ': np. random . normal (loc=14, scale=3, size=300),
                   ' rebounds ': np. random . normal (loc=12, scale=1, size=300)})

#view head of DataFrame
print ( df.head ())

      points assists rebounds
0 23.248691 20.197350 10.927036
1 18.776487 9.586529 12.495159
2 18.943656 11.509484 11.047938
3 17.854063 11.358267 11.481854
4 21.730815 13.162707 10.538596

DataFrame ကော်လံသုံးခုမှ တစ်ခုစီအတွက် ဟီစတိုဂရမ်တစ်ခုကို ဖန်တီးရန် အောက်ပါ syntax ကို အသုံးပြုနိုင်ပါသည်။

 import matplotlib. pyplot as plt

#define format for subplots (1 row and 3 columns)
fig, axis = plt. subplots (1, 3)

#create histogram for each column in DataFrame
df. hist (ax=axis)

ရလဒ်မှာ DataFrame ကော်လံတစ်ခုစီအတွက် ကော်လံတစ်ခုစီအတွက် ဟီစတိုဂရမ်ကို ပြသသည့် အတန်းတစ်ခုနှင့် ကော်လံသုံးခုပါသည့် ဂရစ်တစ်ခုဖြစ်သည်။

အကယ်၍ သင်သည် ဟစ်စတိုဂရမ် များ၏ အရွယ်အစားအပြင် အစွန်းအရောင် နှင့် ဇယား ကွက်များကို ပြောင်းလဲရန် ပုံရိပ်အရွယ်အစား အငြင်းအခုံကို အသုံးပြုနိုင်သည်။

 import matplotlib. pyplot as plt 

#define format for subplots
fig, axis = plt. subplots (1, 3, figsize=(8,3))

#create histogram for each column in DataFrame
df. hist (ax=axis, edgecolor=' black ', grid= False ) 

ပန်ဒါများသည် DataFrame ရှိ ကော်လံတစ်ခုစီအတွက် ဟီစတိုဂရမ်တစ်ခုကို ဖန်တီးသည်။

histograms ၏အတိအကျဖော်မတ်နှင့်အရွယ်အစားကိုသတ်မှတ်ရန် subplots() function ၏အကြောင်းပြချက်များနှင့်ကစားရန်အခမဲ့ခံစားရပါ။

ထပ်လောင်းအရင်းအမြစ်များ

အောက်ဖော်ပြပါ သင်ခန်းစာများသည် ပန်ဒါများတွင် အခြားဘုံအလုပ်များကို မည်သို့လုပ်ဆောင်ရမည်ကို ရှင်းပြသည်-

Pandas histogram တွင်အသုံးပြုသော bins အရေအတွက်ကို မည်သို့ပြောင်းလဲမည်နည်း။
Pandas histogram ရှိ X ဝင်ရိုးအကွာအဝေးကို ဘယ်လိုပြောင်းမလဲ။
Pandas တွင် အုပ်စုအလိုက် ဟီစတိုဂရမ်များကို မည်သို့ဆွဲမည်နည်း။

မှတ်ချက်တစ်ခုထည့်ပါ။

သင့် email လိပ်စာကို ဖော်ပြမည် မဟုတ်ပါ။ လိုအပ်သော ကွက်လပ်များကို * ဖြင့်မှတ်သားထားသည်