Dab tsi yog DataFrame object?
Dab tsi yog DataFrame object?

Video: Dab tsi yog DataFrame object?

Video: Dab tsi yog DataFrame object?
Video: Python! Converting Between a pandas DataFrame and a Dictionary 2024, Hlis ntuj nqeg
Anonim

DataFrame . DataFrame yog 2-dimensional sau cov ntaub ntawv qauv nrog txhua kab uas muaj peev xwm sib txawv. Koj tuaj yeem xav txog nws zoo li daim ntawv nthuav qhia lossis SQL rooj, lossis cov lus hais ntawm Series khoom . Nws yog feem ntau siv pandas khoom.

Ib yam li ntawd, tib neeg nug, dab tsi yog pandas series vs DataFrame?

Qhov tseem ceeb pandas cov ntaub ntawv qauv. Yog li, cov Series yog cov ntaub ntawv qauv rau ib kab ntawm ib DataFrame , tsis tsuas yog conceptually, tab sis hais lus, i.e. cov ntaub ntawv nyob rau hauv a DataFrame yog tau khaws cia rau hauv lub cim xeeb raws li ib tug sau ntawm Series . Analogously: Peb xav tau ob daim ntawv teev npe thiab matrices, vim matrices yog tsim nrog cov npe.

Tsis tas li ntawd, dab tsi yog cov khoom series hauv pandas? Pandas Series yog ib daim ntawv sau npe array muaj peev xwm tuav cov ntaub ntawv ntawm txhua hom (tus lej, hlua, ntab, python khoom , thiab lwm yam). Cov ntawv cim axis yog sib sau ua ke hu ua index. Cov khoom txhawb nqa ob qho tag nrho thiab daim ntawv lo-raws li indexing thiab muab ntau txoj hauv kev rau kev ua haujlwm nrog rau qhov ntsuas.

Kuj kom paub, koj tsim cov ntaub ntawv li cas?

# luam tawm dataframe . Rau tsim DataFrame los ntawm dict ntawm narray / daim ntawv teev, tag nrho cov narray yuav tsum muaj tib ntev. Yog tias qhov ntsuas tau dhau lawm ces qhov ntsuas qhov ntev yuav tsum sib npaug rau qhov ntev ntawm cov arrays. Yog tias tsis muaj qhov ntsuas tau dhau, ces los ntawm lub neej ntawd, qhov ntsuas yuav yog range(n) qhov twg n yog qhov ntev array.

Dab tsi yog hom khoom hauv pandas?

dtypes. Pandas DataFrame yog ob-dimensional loj-mutable, muaj peev xwm heterogeneous tabular cov ntaub ntawv qauv nrog sau npe axes (kab thiab kab). Pandas DataFrame. dtypes attribute rov qab dtypes hauv DataFrame. Nws rov qab Series nrog cov ntaub ntawv hom ntawm txhua kab.

Pom zoo: