1
1
# Introduction_to_Pandas_Library_and_DataFrames
2
2
3
-
4
- > Content Creator - Krishna Kaushik
5
-
6
3
** As you have learnt Python Programming , now it's time for some applications.**
7
4
8
5
- Machine Learning and Data Science is the emerging field of today's time , to work in this this field your first step should be ` Data Science ` as Machine Learning is all about data.
@@ -110,42 +107,15 @@ You can also create a DataFrame by using `pd.DataFrame()` and passing it a Pytho
110
107
# Let's create
111
108
cars_with_colours = pd.DataFrame({" Cars" : [" BMW" ," Audi" ," Thar" ," Honda" ],
112
109
" Colour" : [" Black" ," White" ," Red" ," Green" ]})
113
- cars_with_colours
110
+ print ( cars_with_colours)
114
111
```
115
- <table border =" 1 " class =" dataframe " >
116
- <thead >
117
- <tr style="text-align: right;">
118
- <th></th>
119
- <th>Cars</th>
120
- <th>Colour</th>
121
- </tr>
122
- </thead >
123
- <tbody >
124
- <tr>
125
- <th>0</th>
126
- <td>BMW</td>
127
- <td>Black</td>
128
- </tr>
129
- <tr>
130
- <th>1</th>
131
- <td>Audi</td>
132
- <td>White</td>
133
- </tr>
134
- <tr>
135
- <th>2</th>
136
- <td>Thar</td>
137
- <td>Red</td>
138
- </tr>
139
- <tr>
140
- <th>3</th>
141
- <td>Honda</td>
142
- <td>Green</td>
143
- </tr>
144
- </tbody >
145
- </table >
146
- </div >
147
-
148
112
113
+ Cars Colour
114
+ 0 BMW Black
115
+ 1 Audi White
116
+ 2 Thar Red
117
+ 3 Honda Green
118
+
149
119
150
120
The dictionary key is the ` column name ` and value are the ` column data ` .
151
121
@@ -194,42 +164,15 @@ age
194
164
195
165
record = pd.DataFrame({" Student_Name" :students ,
196
166
" Age" :age})
197
- record
167
+ print ( record)
198
168
```
199
- <table border =" 1 " class =" dataframe " >
200
- <thead >
201
- <tr style="text-align: right;">
202
- <th></th>
203
- <th>Student_Name</th>
204
- <th>Age</th>
205
- </tr>
206
- </thead >
207
- <tbody >
208
- <tr>
209
- <th>0</th>
210
- <td>Ram</td>
211
- <td>19</td>
212
- </tr>
213
- <tr>
214
- <th>1</th>
215
- <td>Mohan</td>
216
- <td>20</td>
217
- </tr>
218
- <tr>
219
- <th>2</th>
220
- <td>Krishna</td>
221
- <td>21</td>
222
- </tr>
223
- <tr>
224
- <th>3</th>
225
- <td>Shivam</td>
226
- <td>24</td>
227
- </tr>
228
- </tbody >
229
- </table >
230
- </div >
231
-
232
169
170
+ Student_Name Age
171
+ 0 Ram 19
172
+ 1 Mohan 20
173
+ 2 Krishna 21
174
+ 3 Shivam 24
175
+
233
176
234
177
235
178
``` python
@@ -269,53 +212,19 @@ record.dtypes
269
212
270
213
271
214
``` python
272
- record.describe() # It only display the results for numeric data
215
+ print ( record.describe() ) # It only display the results for numeric data
273
216
```
274
- <table border =" 1 " class =" dataframe " >
275
- <thead >
276
- <tr style="text-align: right;">
277
- <th></th>
278
- <th>Age</th>
279
- </tr>
280
- </thead >
281
- <tbody >
282
- <tr>
283
- <th>count</th>
284
- <td>4.000000</td>
285
- </tr>
286
- <tr>
287
- <th>mean</th>
288
- <td>21.000000</td>
289
- </tr>
290
- <tr>
291
- <th>std</th>
292
- <td>2.160247</td>
293
- </tr>
294
- <tr>
295
- <th>min</th>
296
- <td>19.000000</td>
297
- </tr>
298
- <tr>
299
- <th>25%</th>
300
- <td>19.750000</td>
301
- </tr>
302
- <tr>
303
- <th>50%</th>
304
- <td>20.500000</td>
305
- </tr>
306
- <tr>
307
- <th>75%</th>
308
- <td>21.750000</td>
309
- </tr>
310
- <tr>
311
- <th>max</th>
312
- <td>24.000000</td>
313
- </tr>
314
- </tbody >
315
- </table >
316
- </div >
317
-
318
217
218
+ Age
219
+ count 4.000000
220
+ mean 21.000000
221
+ std 2.160247
222
+ min 19.000000
223
+ 25% 19.750000
224
+ 50% 20.500000
225
+ 75% 21.750000
226
+ max 24.000000
227
+
319
228
320
229
#### 3. Use ` .info() ` to find information about the dataframe
321
230
@@ -333,9 +242,3 @@ record.info()
333
242
1 Age 4 non-null int64
334
243
dtypes: int64(1), object(1)
335
244
memory usage: 196.0+ bytes
336
-
337
-
338
-
339
- ``` python
340
-
341
- ```
0 commit comments