# Pandas Series - Exercises¶

```
import numpy as np
import pandas as pd
# This will help the formatting in the notebook, it's not important:
pd.options.display.float_format = '{:20,.2f}'.format
```

### Exercise 1¶

Using Pandas, create a Series with numbers from `10`

to `15`

, and `float`

type.

```
# your code goes here
```

```
series = pd.Series(data=np.arange(10, 16),
dtype=np.float64)
series
```

### Exercise 2¶

Add indexes from `A`

to `F`

to the previous series.

```
# your code goes here
```

```
series.index = ['A', 'B', 'C', 'D', 'E', 'F']
series
```

### Exercise 3¶

Add a new element to the series: `G: 20.0`

.

```
# your code goes here
```

```
series['G'] = 20.0
series
```

### Exercise 4¶

Remove the first element from the series.

```
# your code goes here
```

```
series.drop('A', inplace=True) # also, del series['A']
series
```

### Exercise 5¶

Get the value at `D`

index.

```
# your code goes here
```

```
series['D']
```

### Exercise 6¶

Get the values from `B`

to `E`

indexes.

```
# your code goes here
```

```
series['B':'E']
```

### Exercise 7¶

Get all the values higher than 12.

```
# your code goes here
```

```
series[series > 12.0]
```

### Exercise 8¶

Get the mean of all the series elements.

```
# your code goes here
```

```
series.mean()
```

### Exercise 9¶

Add 10 to the values higher than 14.

```
# your code goes here
```

```
series[series > 14.0] += 10
series
```

### Exercise 10¶

Double series elements lower than 14.

```
# your code goes here
```

```
series[series < 14.0] = 2 * series[series < 14.0]
series
```

For the following exercises, we'll read the *csv* file located in `data/salaries.csv`

, that contains salaries of NBA Players (original can be found here).

We haven't dug into reading CSV files yet (there's a special lesson about that later), so we've already included the line that reads the salaries into a series.

```
salaries = pd.read_csv('data/salaries.csv', squeeze=True, index_col=0)
salaries.head().to_frame()
```

### Exercise 11¶

Using Pandas, create a Series with numbers from `10`

to `15`

, and `float`

type.

How many players does the series `salaries`

have?

```
# your code goes here
```

```
salaries.size
```

### Exercise 12¶

What are the highest and lowest salaries on the league?

```
# your code goes here
```

```
# Highest:
salaries.max()
```

```
# Lowest:
salaries.min()
```

### Exercise 13¶

Show us `LeBron James`

's salary (make sure you don't make a typo with his name, you'll get a `KeyError`

otherwise):

```
# your code goes here
```

```
salaries.loc['LeBron James']
```

### Exercise 14¶

Show us the first 10 players in the series:

```
# your code goes here
```

```
```

```
```

```
```

```
```