Intro To Python Flashcards

1
Q

What are Strings?

A

Strings are primitive data type of the python language. You can think of a data type as a building block of a language. The content inside the print function is a string.(“word here”)

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

What are Booleans?

A

Boolean assess the truth of something. Boolean values are either true are false. Example: 5>7 is 5 greater than 7? = false, 7<5 is 5 smaller than 7? = true

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

Conditional Logic

A
Comparison operator, Meaning
<            Less than
<=          Less than or equal to
>            greater than
>=          greater than or equal to
==          equal
!=           not equal
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

What is numpy?

A

¹

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

True or Flase statement?
Num = 3
Is number > 10
Print(num)

A

True

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

Logical Operators?

A
And, or, not 
Can be used in conjunction with conditional logic ex:
Num = 4
print(num > 0 and num < 15)
Output: true
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

The 3 main file types and the functions to load them?

A

.csv files - pd.read_csv(‘filepath’)
.xlsx files - pd.read_excel(‘filepath’)
‘Filepath’ can be remote URL if it points to .csv or.xlsx file

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

What is df.info()

A

To get lots of info in, including data type, index, and column names

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

What is df.dtypes

A

To get just the data type for just all column

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

What us df.[‘name’].dtypes

A

To get the data type for just one column

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

What is df.head()

A

This will give you the top 5 rows

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

What us df.head(8)

A

To see a different number of rows such as the first 8 rows

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

What is df.tail()

A

To see the bottom 5 rows

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

What is df.tail(11)

A

To see a different number of rows such as the last 11 rows

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

What is df.sample(5)

A

To see 5 random rows

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

What are functions?

A

The syntax

17
Q

How is list used?

A

z = [3, 7, 4, 2]
index 0 1 2 3
Neg index -4 -3 -2 -1

18
Q

What does Slicing Dataframes mean?

A

Selecting specific colums

19
Q

what is df.[‘name’]

A

To select 1 column as a pandas series

20
Q

What is df[[‘name’]]

A

To select 1 column as a pandas dataframe

21
Q

What is df[[‘name’, ‘manufacturer’]]

A

To select multiple columns as a dataframe

22
Q

What is df.info()

A

To get lots of info including data type, index, and column names

23
Q

What is df.shape

A

To get the shape(rows, columns)

24
Q

What is Len(df)

A

To get the number of rows

25
What is len(df.columns)
To get the number of columns
26
What is a else statement?
Must be after an if or elif statement . There can be at most one else statement. Will only execute if all the "if" and "elif" statement above it are false
27
What's elif statement?
"elif" is the shortened code for "else if". Must be after an if statement
28
If, elif and else statements in use for catchfall condition
``` Num = 5 if num > 50: print('num is larger than 50') elif num == 21: print('num = 21') else: print('catchfall condition') ```
29
What is a list?
An ordered collection of items which can be of different types. Lists are mutable
30
What is a float?
A number that is not a whole number, example: 0.25 or 1/2
31
What is an integer?
A whole number inside a list
32
How to perform exponentiation?
By using two asterisks, example: 2**5
33
Quotient, what is a floor division?
Done by using two forward slashes and is used to determine the quotient of a division, example: print(20//6) Output: 3, because 6 goes into 20 three times
34
What is a modular operator?
A % symbol used to get the remainder of a division. Example: print(20%6) Output-
35
What does Newlines- \n represent?
It can be used to create multi-line output, example: print('one\nTwo\nThree')
36
What is stack?
Tacking is a Last-in-First-out (LIFO) principle. The last item you out in, is the first you you take out
37
What is queue?
Like the name suggests, follow the First-in-First-out (FIFO) principle. First item that was put in is the first item taken out