An warware: yadda ake shigar pandas a cikin Python ta git

A cikin duniyar yau, ma'amala da bayanai ya zama fasaha mai mahimmanci ga masu haษ“akawa da manazarta baki ษ—aya. ฦŠaya daga cikin ษ—akin karatu mai ฦ™arfi wanda ke taimakawa wajen yin nazarin bayanai shine pandas, wanda aka gina a saman Python programming language. A cikin wannan labarin, za mu dubi yadda ake shigar pandas a Python ta amfani da Git, fahimtar aikin ษ—akin karatu, kuma bincika ayyuka daban-daban waษ—anda za su taimaka a ayyukan nazarin bayanan mu. Don haka, bari mu nutse a ciki.

Shigar da pandas ta amfani da Git

Don shigar da pandas ta amfani da Git, da farko kuna buฦ™atar rufe ma'ajiyar pandas daga GitHub zuwa injin ku na gida. Da zarar kun sami kwafin ma'ajiyar, zaku iya bin matakan da aka ambata a ฦ™asa don saita komai yadda yakamata.

git clone git://github.com/pandas-dev/pandas.git
cd pandas
python -m venv venv
source venv/bin/activate  # On Windows use `venvScriptsactivate`
pip install -e .

Lambar da ke sama tana yin haka:

  • Yana rufe ma'ajiyar pandas.
  • Yana canza kundin adireshi na yanzu zuwa babban fayil na pandas.
  • Yana ฦ™irฦ™ira yanayin kama-da-wane da ake kira "venv".
  • Yana kunna yanayin kama-da-wane.
  • Shigar da pandas a cikin yanayin gyarawa, wanda zai ba ku damar canza lambar tushe kai tsaye.

Yanzu da muka shigar da pandas ta hanyar Git, za mu iya fara aiki da shi a Python.

Farawa da pandas

Don fara amfani da pandas, kuna buฦ™atar shigo da ษ—akin karatu a cikin lambar Python ku. Kuna iya yin wannan ta amfani da umarni mai zuwa:

import pandas as pd

Tare da pandas da aka shigo da su yanzu, zaku iya fara aiki tare da saitin bayanai ta nau'i daban-daban, kamar CSV, Excel, ko SQL. Pandas yana amfani da mahimman bayanai guda biyu don sarrafa bayanai: DataFrame da kuma series.

A DataFrame tebur ne mai girma biyu tare da alamar gatura, yayin da jeri mai girma ษ—aya ne, tsararru mai lakabi. Waษ—annan tsarin bayanan suna ba ku damar aiwatar da ayyuka daban-daban da nazari akan bayanan ku.

Loda bayanai da bincike

Don nuna yadda ake amfani da pandas, bari mu yi la'akari da saitin bayanan samfurin - fayil ษ—in CSV tare da cikakkun bayanai game da samfuran daban-daban, nau'ikan su, da farashin su. Kuna iya loda fayil ษ—in kuma ฦ™irฦ™irar DataFrame kamar haka:

data = pd.read_csv('products.csv')

Don duba abubuwan da ke cikin DataFrame, yi amfani da umarni mai zuwa:

print(data.head())

The kai() Aiki yana dawo da layuka biyar na farko na DataFrame. Hakanan zaka iya yin wasu ayyuka kamar ฦ™ididdige ฦ™ididdiga, tace bayanai, da sarrafa ginshiฦ™ai ta amfani da ayyukan pandas.

Kammalawa

Ta wannan labarin, mun koyi yadda ake shigar pandas a Python ta amfani da Git kuma ya bincika ainihin ra'ayoyin ษ—akin karatu, kamar DataFrames da Series. Bugu da ฦ™ari, mun koyi game da lodawa da bincika bayanai ta amfani da ayyukan pandas. Tare da waษ—annan mahimman ra'ayoyi, yanzu an sanye ku da ilimin da ake buฦ™ata don aiwatar da ayyukan nazarin bayanai a cikin ayyukanku. Yayin da kuke ci gaba da aiki tare da pandas, tabbatar da bincika ษ—imbin ayyuka da hanyoyin da wannan ษ—akin karatu mai ฦ™arfi zai bayar - akwai ฦ™arin koyo a cikin duniyar bayanai!

Shafi posts:

Leave a Comment