Thuta Learning
ရှာဖွေရန်
BasicData & Databasesintermediate

Core: DataFrame

စိတ်လျှော့ပါ။ ဒီခန်းကို စာအုပ်လိုမဟုတ်ဘဲ စကားပြောသလိုပဲ၊ နားလည်လွယ်အောင် ရှင်းပါမယ်။

DataFrame — Pandas ရဲ့ အဓိက table

DataFrame သည် rows နှင့် columns ပါသော table data structure ဖြစ်ပါတယ်။ Excel spreadsheet, database table, CSV file တို့နဲ့ အတွေးအခေါ်တူပါတယ်။ Pandas project တော်တော်များများမှာ အဓိကအလုပ်လုပ်ရမယ့် object က DataFrame ပါ။

python
import pandas as pd

data = {
    "Name": ["Alice", "Bob", "Charlie"],
    "Age": [25, 30, 35],
    "City": ["New York", "Paris", "London"]
}

df = pd.DataFrame(data)
print(df)

Dictionary ထဲက key တွေဖြစ်တဲ့ Name, Age, City က column names ဖြစ်သွားပါတယ်။ List ထဲက တန်ဖိုးတွေက row data ဖြစ်ပါတယ်။ DataFrame တစ်ခုကို ဖန်တီးပြီးတာနဲ့ column ရွေးခြင်း၊ filter လုပ်ခြင်း၊ statistics တွက်ခြင်းတွေ လုပ်နိုင်ပါပြီ။

You should see
Name Age City 0 Alice 25 New York 1 Bob 30 Paris 2 Charlie 35 London

Info

Column တစ်ခုစီရဲ့ list length တူရပါမယ်။ Name မှာ 3 ခုရှိပြီး Age မှာ 2 ခုပဲရှိရင် DataFrame တည်ဆောက်လို့မရပါ။