Flashcards
Data Analysis Basics

Cards in this deck (66)
- 1What is a markdown cell and how do you create a markdown cell?M - A markdown cell is a cell that contains strictly text.
Bonus point: You can also add a # into a coding cell and this will be digested as text and not code!! - 2Why is hiding an output handy and how do you do this?O - this is handy when you have large tables etc
- 3Line numbers - how do you initiate them and why are they useful?L
To specify a particular sequence of code by numbering each line - comes in handy when you've large amounts of code. - 4How can you go about re-running the output of a code?Go to Kernel on the toolbar - Restart & Clear Output and then Restart & Run
- 5What prompt is needed to convert a markdown cell back to a code cell?Y
- 6What is an integer Holly?An integer is a whole number - whether positive or negative
Therefore a fraction or number with a decimal cannot be an integer.
x1=5
type(x1)
float - 7What is the term used to identify a number WITH decimal places?Float
x2 = 5.67
type(x2)
int - 8What is Boolean?Boolean means a result that can only have one of two possible values: True or False
- 9How do you input a new cell aboveA
- 10What is a string?Text values comprised of a sequence of characters.
For example: "hello world" and "LKJH019283" - 11How do i assign a string to a variablei.e. x4 = "Sally"
x4
'Sally'
For straight text :
x4="Sally"
print(x4)
Sally - 12How do you convert a text into a number?str()
y = 10
print (str(y) + " Dollars")
10 Dollars - 13Can you tell me how i can get 10 dollars to the variable of y =10Use str()
First assign a variable to the number
y=10
print (str(y) + " Dollars")
Y is an integer and Dollars is a string
str() converts a number into text - 14Create the output "I'm fine" *There are two ways to accomplish thisYou cannot use singular speech marks due to the apostrophe
1. Double speech marks " "
2. Back slash \ before the symbol - 15How do you input a new cell belowB
- 16What are three ways to achieve 'Blue waffle'Singular Speech mark 'Blue ' 'waffle'
"" with a plus sign 'Blue ' + 'waffle'
Print brackets + print ('Blue ' + 'waffle') - 17If i want to change a variable from a float to an integer what do i need to do?ADD int(x2)
In [4]:x2 = 4.75
In [5]:type(x2)
Out[5]:float
In [6]: int(x2)
Out[6]:4 - 18Function of NOT?Leads to the opposite of the given statement
- 19How can i calculate the exact answer 17 divided 5?Using Float or using decimals
float(17) / 5
17.0 / 5 - 20How do you get an output?Shift + Enter
- 21What is an operand? Bonus: What are operators?Operand a data item on which operators perform operations i.e x 2 y 5 etc
BONUS: operator a symbol that tells the compiler to perform specific mathematical or logical functions. i.e - = / * etc - 22What symbols is used to implement a comment into code?#
#LAAAME ;) - 23Function of AND?Checks whether the two statements are true
- 24How do i find out if y is equal to 657?==
Equal to - 25How can i find the power of a number?Use two asterisk
25**3
Raises the left operand to the power of the right operand. - 26How do you implement line continuation?BACKSLASH \
Pop at the end of the line and continue (this needs to be in the same cell) - 27Indexing Elements"Name_of_variable" [index_of_element]
"Friday"[3]
'd' - 28What are the identity operators? Bonus : What do they equate to in symbols?is ==
is not != - 29What does indenting code mean?Indenting code separates commands in a cell. (* indication the blocks of code)
*def five(x):
x = 5
return x
*print (five(3)) - 30Not equal to ?!=
- 31100 < 50 what output will you get and what do they mean/stand for?< Greater than or equal to
> Less than or equal to - 32What are the logical operators? BONUS: if you get the correct order of statementsNOT - AND - OR
- 33Function of OR?Checks whether at least one of the two statements is true
- 34What does it mean when someone wants to find the power of a number?Its mathematics so you need to multiply the number you have by itself.
5**2 = 25
5*5- 15
15*5 = - 35what does max() do?returns the highest value from a sequence of numbers.
- 36What does the function min() do?returns the lowest value from a sequence of numbers.
- 37What does the function abs() do?allows you to obtain the absolute value of its argument.
- 38What does Absolute Value mean?Absolute Value refers to the distance of a number from 0, the distances are positive as absolute value of a number cannot be negative.
i.e z = -20 ab(z) output 20 - 39What does sum() function do.Calculates the sum of all the elements in a list designated as an argument.
- 40What does round(x,y) do?Returns the float of its argument (x), rounded to a specified number of digits (y) after the decimal point.
i.e round(3.555,2) output - 3.56 - 41pow(x,y)returns x to the power of y
pow(2,10) output 1024
bit like 2 ** 10 - 42len()Returns the number of elements in an object
len('Mathematics') 11 - 43How do you write if not a number for an argument"if type(x) == int or type(x) == float:"
return abs(x)
else:
print("Not possible" - 44Why is the order of conditional statements so important?The order and logic of your code is imperative because computational logic is basic and if a statement is true but does not give you a clear answer the computer will not know and only give you a result based on whether something is true.
- 45What does return do?Return is a command to return a value to the function/object/operating system/ variable in memory that called the function. Return will typically end a function (the program assumes the function did it’s job and will not continue to execute the rest of the code).Return can only be used once in a function.
- 46What does 'print' function do?The print () function prints the specified message to the screen, or other standard output device. print needs to be indented.
- 47What is a list? BONUS: What must you use?A list is a type of sequence of data points such as floats integers or strings.
You must use square brackets [] and quotation marks '' - 48What keyword removes an item from a listdel
- 49How do you replace an item/object in a list? ['John', 'Leila', 'Gregory', 'Cate'] Cate Quits but Maria replaces herParticipants[3]='Maria'
Participants
Out[5]:
['John', 'Leila', 'Gregory', 'Maria'] - 50How do you extract Leila from the list? ['John', 'Leila', 'Gregory', 'Cate'REMEMBER 0-3
print (Participants[1]) - 51What do i need to do to extra a name from a list - going from back to front i.e Gregory ['John', 'Leila', 'Gregory', 'Cate']Participants[-2]
The minus sign will obtain back to front - 52How do you add a new object to a listname_of_list_DOT OPERATOR(.)append(addition_of_object) append method
Participants.append("Dwayne")
Participants
Out[8]: ['John', 'Leila', 'Maria', 'Dwayne'] - 53What is extend() method?The extend method in python will add multiple elements to a list that is already created. It's more advance than the append method. It will not return a new list but modify the existing list by adding an element at the end of the list.
Participants.extend(['George', 'Catherine']) - 54Create the sentence: The first participant is John. Using a list and print. List; John,Samantha,Claireprint ('The first participant is ' + Participants[0] + '.')
- 55How can you confirm the number of elements in a list?len()
len(name_of_list) - 56What is the syntax for invoking a method in Python?Name of the object, dot operator, name of the method, parentheses
- 57What is the append() metohd?The append method in python will add an element to a list that is already created. The append method takes only one element as a parameter and adds at the end of the list. It will not return a new list but modify the existing list by adding an element at the end of the list.
list_name.append(element) - 58Differences between extend and append method

- 59Numbers = [15, 40, 50, 100, 115, 140] Using the list slicing, obtain the numbers 100 and 115Numbers[3:5]
remember that you need to add an extra number to the last one.
So 100 (3) + 115 (4)
BUT we do 3:5 to obtain the 115. - 60Using slicing, extract the first four elements from the list. Numbers = [15, 40, 50, 100, 115, 140]Numbers[:4]
[15, 40, 50, 100]
When you need it from the start you don't need to type anything because its 0.
To obtain the first no only
Numbers[:1] - 61Using slicing, extract the last four elements from the list Numbers = [15, 40, 50, 100, 115, 140]Numbers[-4:]
[50, 100, 115, 140] - 62How do you combine two listsTwo_Numbers =[1,2]
Two_Numbers
[1, 2]
Bigger_List= [Numbers, Two_Numbers]
Bigger_List
[[15, 40, 50, 100, 115, 140], [1, 2]]
There will be no need for "" OR '' - 63How does the syntax indicate that you have a tuple and not a list?Tuple's elements are placed within parentheses.
- 64Give me an example of a comma-separated value"17,3"
- 65Functions can provide tuples as return values this is useful because.....a function which can only return a single values otherwise can produce a tuple holding multiple values
- 66In [ * ] what do you need to do? JupyterYou need to stop the kernnel and re-run
the code is basically being ran / processing but not developing
Information
- Description
- My own Data Analaysis Basics Flashcards on Data Analysis Basics, created by Valentine Attew on 01/01/2023.
- Created by
- Valentine Attew · Jan 2023
- Updated
- Feb 1, 2023
- Views
- 0
- Rating