Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

11/18/22, 11:43 PM Pandas.

ipynb - Colaboratory

import pandas as pd

data=pd.read_csv("/Dummy_Data.csv")

data

Shape Color Calories Fruit

0 Round Orange 50.0 Orange

1 Long Yellow 70.0 Banana

2 Round Red 60.0 NaN

3 Round Blue 50.0 Orange

4 Long Yellow 70.0 Banana

5 square Red 60.0 Apple

6 Round Orange 50.0 Orange

7 Long Blue 70.0 Banana

8 Round Red NaN Apple

9 Round Orange 50.0 NaN

10 Long Yellow 70.0 Banana

11 square Red 60.0 Apple

12 Round Orange NaN Orange

13 Long Yellow 70.0 Banana

14 Round Red 60.0 Apple

15 square Orange 50.0 Orange

16 Long Yellow NaN Banana

17 Round Red 60.0 Apple

18 Round Orange NaN Orange

19 Long Yellow 70.0 Banana

20 Round Blue 60.0 Apple

data.to_csv("/content/drive/MyDrive/Colab Notebooks/Pandas/ClassWork")

data.info()

<class 'pandas.core.frame.DataFrame'>

RangeIndex: 21 entries, 0 to 20

Data columns (total 4 columns):

https://colab.research.google.com/drive/1y9ZCLCqpEST3xlPvwog9XJjd3ce9b_eR#printMode=true 1/4
11/18/22, 11:43 PM Pandas.ipynb - Colaboratory

# Column Non-Null Count Dtype

--- ------ -------------- -----

0 Shape 18 non-null object

1 Color 18 non-null object

2 Calories 17 non-null float64

3 Fruit 19 non-null object

dtypes: float64(1), object(3)

memory usage: 800.0+ bytes

data.tail()

Shape Color Calories Fruit

16 Long Yellow NaN Banana

17 Round Red 60.0 Apple

18 Round Orange NaN Orange

19 Long Yellow 70.0 Banana

20 Round NaN 60.0 Apple

data.isnull()

https://colab.research.google.com/drive/1y9ZCLCqpEST3xlPvwog9XJjd3ce9b_eR#printMode=true 2/4
11/18/22, 11:43 PM Pandas.ipynb - Colaboratory

Shape Color Calories Fruit

0 False False False False

1 False False False False

2 False False False True

3 False
data.dropna()
True False False

4 False False False False


Shape Color Calories Fruit
5 True False False False
0 Round Orange 50.0 Orange
6 False False False False
1 Long Yellow 70.0 Banana
7 False True False False
4 Long Yellow 70.0 Banana
8 False False True False
6 Round Orange 50.0 Orange
9 False False False True
10 Long Yellow 70.0 Banana
10 False False False False
13 Long Yellow 70.0 Banana
11 True False False False
14 Round Red 60.0 Apple
12 False False True False
17 Round Red 60.0 Apple
13 False False False False
19 Long Yellow 70.0 Banana
14 False False False False

15 True False False False


data["Shape"]

16 False False True False


0 Round

17 False False False False


1 Long

218 False
Round
False True False
3 Round

419 False
Long
False False False
5 NaN

620 False
Round
True False False
7 Long

8 Round

9 Round

10 Long

11 NaN

12 Round

13 Long

14 Round

15 NaN

16 Long

17 Round

18 Round

19 Long

20 Round

Name: Shape, dtype: object

data["Fruit"].fillna("Mango",inplace=True)

data

https://colab.research.google.com/drive/1y9ZCLCqpEST3xlPvwog9XJjd3ce9b_eR#printMode=true 3/4
11/18/22, 11:43 PM Pandas.ipynb - Colaboratory

Colab paid products


-
Cancel contracts here

https://colab.research.google.com/drive/1y9ZCLCqpEST3xlPvwog9XJjd3ce9b_eR#printMode=true 4/4

You might also like