Pandas Series Flashcards

1
Q

Where
my_list = [10,20,30]
:

pd.Series(data=my_list)

A

0 10
1 20
2 30
dtype: int64

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Where
labels = [‘a’,’b’,’c’]
my_list = [10,20,30]
:

pd.Series(data=my_list,index=labels)

A

a 10
b 20
c 30
dtype: int64

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Simplify pd.Series(data=my_list,index=labels)

A

pd.Series(my_list,labels)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Where
arr = np.array([10,20,30])
:

pd.Series(arr)

A

0 10
1 20
2 30
dtype: int64

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Where
arr = np.array([10,20,30])
labels = [‘a’,’b’,’c’]
:

pd.Series(arr,labels)

A

a 10
b 20
c 30
dtype: int64

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Where
d = {‘a’:10,’b’:20,’c’:30}
:

pd.Series(d)

A

a 10
b 20
c 30
dtype: int64

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Where
labels = [‘a’,’b’,’c’]
:

pd.Series(data=labels)

A

0 a
1 b
2 c
dtype: object

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

pd.Series([sum,print,len])

A

0 <built-in>
1 <built-in>
2 <built-in>
dtype: object</built-in></built-in></built-in>

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Where
ser1 = pd.Series([1,2,3,4],index = [‘USA’, ‘Germany’,’USSR’, ‘Japan’])
:

ser1

A

USA 1
Germany 2
USSR 3
Japan 4
dtype: int64

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Where
ser2 = pd.Series([1,2,5,4],index = [‘USA’, ‘Germany’,’Italy’, ‘Japan’])
:

ser2

A

USA 1
Germany 2
Italy 5
Japan 4
dtype: int64

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Where
ser1 = pd.Series([1,2,3,4],index = [‘USA’, ‘Germany’,’USSR’, ‘Japan’])
:

ser1[‘USA’]

A

1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Where
ser1 = pd.Series([1,2,3,4],index = [‘USA’, ‘Germany’,’USSR’, ‘Japan’])

ser1[‘USA’]Where ser2 = pd.Series([1,2,5,4],index = [‘USA’, ‘Germany’,’Italy’, ‘Japan’])
:

ser1 + ser2

A

Germany 4.0
Italy NaN
Japan 8.0
USA 2.0
USSR NaN
dtype: float64

How well did you know this?
1
Not at all
2
3
4
5
Perfectly