pandas DataFrames तक पहुँचना

MATLAB उपयोगकर्ताओं के लिए Python

Justin Kiggins

Product Manager

कई कॉलम चुनना (dataframe)

pets[['frac_dog_owners','rank']]
                      frac_dog_owners  rank
state                                      
Alabama                         0.441    17
Arizona                         0.401    18
Arkansas                        0.479     6
California                      0.328    40
...
Virginia                        0.354    37
Washington                      0.363     5
West Virginia                   0.458     7
Wisconsin                       0.339    21
Wyoming                         0.388     9
MATLAB उपयोगकर्ताओं के लिए Python

पंक्तियाँ चुनना

  1. .loc के साथ pandas इंडेक्सिंग
  2. .iloc के साथ Python इंडेक्सिंग
MATLAB उपयोगकर्ताओं के लिए Python

pandas इंडेक्सिंग से पंक्तियाँ चुनना

pets.loc['Massachusetts']
rank                    47.000
num_households     2618000.000
frac_dog_owners          0.236
frac_cat_owners          0.341
Name: Massachusetts, dtype: float64
MATLAB उपयोगकर्ताओं के लिए Python

Python इंडेक्सिंग से पंक्तियाँ चुनना

pets.iloc[17]
rank                    4.000
num_households     548000.000
frac_dog_owners         0.346
frac_cat_owners         0.464
Name: Maine, dtype: float64
MATLAB उपयोगकर्ताओं के लिए Python

अभ्यास करते हैं!

MATLAB उपयोगकर्ताओं के लिए Python

Preparing Video For Download...