DataFrames का परिचय

pandas के साथ Data Manipulation

Richie Cotton

Data Evangelist at DataCamp

pandas का मकसद क्या है?

pandas के साथ Data Manipulation

Course outline

  • Chapter 1: DataFrames
    • Sorting और subsetting
    • नए कॉलम बनाना
  • Chapter 2: Aggregating Data
    • Summary statistics
    • Counting
    • Grouped summary statistics
  • Chapter 3: Slicing और Indexing Data

    • Slicing से subsetting
    • Indexes और indexes से subsetting
  • Chapter 4: Data बनाना और Visualize करना

    • Plotting
    • Missing data हैंडल करना
    • DataFrame में data पढ़ना
pandas के साथ Data Manipulation

pandas, NumPy और Matplotlib पर आधारित है

दो आयतों के ऊपर टिका एक त्रिकोण। त्रिकोण pandas पैकेज दर्शाता है, और आयतें NumPy व matplotlib पैकेज दर्शाती हैं.

pandas के साथ Data Manipulation

pandas लोकप्रिय है

पांडा इमोजी सैकड़ों बार दोहराया गया, जो pandas के अनेक उपयोगकर्ताओं को दर्शाता है.

1 https://pypistats.org/packages/pandas
pandas के साथ Data Manipulation

Rectangular data

नाम नस्ल रंग ऊँचाई (cm) वज़न (kg) जन्म तिथि
Bella Labrador Brown 56 25 2013-07-01
Charlie Poodle Black 43 23 2016-09-16
Lucy Chow Chow Brown 46 22 2014-08-25
Cooper Schnauzer Gray 49 17 2011-12-11
Max Labrador Black 59 29 2017-01-20
Stella Chihuahua Tan 18 2 2015-04-20
Bernie St. Bernard White 77 74 2018-02-27
pandas के साथ Data Manipulation

pandas DataFrames

print(dogs)
      name        breed  color  height_cm  weight_kg date_of_birth
0    Bella     Labrador  Brown         56         24    2013-07-01
1  Charlie       Poodle  Black         43         24    2016-09-16
2     Lucy    Chow Chow  Brown         46         24    2014-08-25
3   Cooper    Schnauzer   Gray         49         17    2011-12-11
4      Max     Labrador  Black         59         29    2017-01-20
5   Stella    Chihuahua    Tan         18          2    2015-04-20
6   Bernie  St. Bernard  White         77         74    2018-02-27
pandas के साथ Data Manipulation

DataFrame एक्सप्लोर करना: .head()

print(dogs.head())
      name        breed  color  height_cm  weight_kg date_of_birth
0    Bella     Labrador  Brown         56         24    2013-07-01
1  Charlie       Poodle  Black         43         24    2016-09-16
2     Lucy    Chow Chow  Brown         46         24    2014-08-25
3   Cooper    Schnauzer   Gray         49         17    2011-12-11
4      Max     Labrador  Black         59         29    2017-01-20
pandas के साथ Data Manipulation

DataFrame एक्सप्लोर करना: .info()

print(dogs.info())
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 7 entries, 0 to 6
Data columns (total 6 columns):
 #   Column         Non-Null Count  Dtype 
 --  ------         --------------  ----- 
 0   name           7 non-null      object
 1   breed          7 non-null      object
 2   color          7 non-null      object
 3   height_cm      7 non-null      int64 
 4   weight_kg      7 non-null      int64 
 5   date_of_birth  7 non-null      object
dtypes: int64(2), object(4)
memory usage: 464.0+ bytes
pandas के साथ Data Manipulation

DataFrame एक्सप्लोर करना: .shape

print(dogs.shape)
(7, 6)
pandas के साथ Data Manipulation

DataFrame एक्सप्लोर करना: .describe()

print(dogs.describe())
       height_cm  weight_kg
count   7.000000   7.000000
mean   49.714286  27.428571
std    17.960274  22.292429
min    18.000000   2.000000
25%    44.500000  19.500000
50%    49.000000  23.000000
75%    57.500000  27.000000
max    77.000000  74.000000
pandas के साथ Data Manipulation

DataFrame के घटक: .to_numpy()

print(dogs.to_numpy())
array([['Bella', 'Labrador', 'Brown', 56, 24, '2013-07-01'],
       ['Charlie', 'Poodle', 'Black', 43, 24, '2016-09-16'],
       ['Lucy', 'Chow Chow', 'Brown', 46, 24, '2014-08-25'],
       ['Cooper', 'Schnauzer', 'Gray', 49, 17, '2011-12-11'],
       ['Max', 'Labrador', 'Black', 59, 29, '2017-01-20'],
       ['Stella', 'Chihuahua', 'Tan', 18, 2, '2015-04-20'],
       ['Bernie', 'St. Bernard', 'White', 77, 74, '2018-02-27']],
      dtype=object)
pandas के साथ Data Manipulation

DataFrame के घटक: .columns और .index

print(dogs.columns)
Index(['name', 'breed', 'color', 'height_cm', 'weight_kg', 'date_of_birth'],
dtype='object')
dogs.index
RangeIndex(start=0, stop=7, step=1)
pandas के साथ Data Manipulation

pandas की सोच (Philosophy)

इसे करने का एक, और बेहतर होगा केवल एक, स्पष्ट तरीका होना चाहिए.

     - The Zen of Python by Tim Peters, Item 13

एक हरा स्विस आर्मी नाइफ

1 https://www.python.org/dev/peps/pep-0020/
pandas के साथ Data Manipulation

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

pandas के साथ Data Manipulation

Preparing Video For Download...