Python for Data Science: Cheat Sheet

0.0(0)
studied byStudied by 1 person
GameKnowt Play
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
Card Sorting

1/19

encourage image

There's no tags or description

Looks like no tags are added yet.

Study Analytics
Name
Mastery
Learn
Test
Matching
Spaced

No study sessions yet.

20 Terms

1
New cards

x = 5

Variable Assignment

2
New cards

x=5

x+2

7

Calculations With Variables

Sum of two variables

3
New cards

x=5

x-2

3

Calculations With Variables

Subtraction of two variables

4
New cards

x=5

x*2

10

Calculations With Variables

Multiplication of two variables

5
New cards

x=5

x**2

25

Calculations With Variables

Exponentiation of two variables

6
New cards

x=5

x%2

1

Calculations With Variables

Remainder of two variables

7
New cards

x=5

x/float(x)

2.5

Calculations With Variables

Division of two variables

8
New cards

str()

Types and Type Conversion

'5', '3.45', 'True' (Variables to strings)

9
New cards

int()

Types and Type Conversion

5, 3, 1 (Variables to integers)

10
New cards

float()

Types and Type Conversion

5.0, 1.0 (Variables to floats)

11
New cards

bool()

Types and Type Conversion

True, True, False (Variables to booleans)

12
New cards

help(str)

Syntax to Asking For Help

13
New cards

Strings

my_string = 'thisStringIsAwesome'

my_string 'thisStringIsAwesome'

14
New cards

String Operations

>>> my_string * 2

'thisStringIsAwesomethisStringIsAwesome'

>>> my_string + 'Innit'

'thisStringIsAwesomeInnit'

>>> 'm' in my_string

True

15
New cards

String Indexing

>>> my_string[3]

>>> my_string[4:9]

16
New cards

my_string.upper()

String Methods

String to uppercase

17
New cards

my_string.lower()

String Methods

String to lowercase

18
New cards

my_string.count('w')

String Methods

Count String elements

19
New cards

my_string.replace('e', 'i')

String Methods

Replace String elements

20
New cards

my_string.strip()

String Methods

Strip whitespaces