Week 1
Week 1
Features include
◦ Code editor with robust syntax and error highlighting
◦ Code completion and navigation
◦ Debugger
◦ Integrated document
Interface similar to MATLAB and RStudio
Python for Data Science 16
Spyder
Features include
◦ Code editor provides syntax and error highlighting
◦ Code completion and navigation
◦ Unit testing
◦ Debugger
◦ Version control
Source-https://jupyter.org/
Source-https://jupyter.org/
Files/ Variables/
Help
Scripts
Console
To choose a
working
directory,
click on the icon
Choose a suitable
location by
clicking on the
indicated icon
Method 3
cd C:/Users/DELL/Desktop
Method 1
RESULT
Console output
Console output
Console output
Environment
Note: You can click the details of the sublibraries by typing libraryname.sublibraryname under object
Eg- numpy.lib in object
Clearing
console and
environment
◦ Snake
◦ Pascal
Basic data
Description Values Representation
types
Complex contains real and imaginary part (a+ib) set of complex numbers complex
+ Addition
+ Addition
- Subtraction
* Multiplication
* Multiplication
/ Division
* Multiplication
/ Division
% Remainder
* Multiplication
/ Division
% Remainder
** Exponent
== Equal to equal to
== Equal to equal to
!= Not equal to
or Logical OR
or Logical OR
or Logical OR
0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1
0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1
0 0 0 0 0 1
0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1
0 0 0 0 0 1 0 1 0 0 0 0 0 1 1 1
0 0 0 0 0 1 1 1
Python for Data Science 28
Bitwise operators
Bitwise
operators can also operate on conditional
statements
Symbol Operation Example
| Bitwise OR
| Bitwise OR
Operators
Unary Operators
+, -, , /, //, * and % are known as operators and these operators can be unary or binary
A unary operator has only one operand
The unary - (minus) operator yields the negation of its numeric argument
The unary + (plus) operator yields its numeric argument unchanged
The unary ~ (invert) operator yields the bit-wise inversion of its plain or long integer argument
Example
In [1]:
Out[1]:
-15
In [2]:
Out[2]:
60
Identity operators
Identity operators are used to compare if two objects are same with the same memory location
They are usually used to determine the data type of a variable
The identity operators are 'is' and 'is not'
‘is’ operator - evaluates to true if the variables on either side of the operator
point to the same object and false otherwise
localhost:8888/notebooks/Desktop/Operators.ipynb 1/3
4/19/2020 Operators - Jupyter Notebook
In [3]:
a = 15
if (type(a) is float):
print ("true")
else:
print ("false") # returns false because the data type of 'a' is 'int' not 'float'
false
‘is not’ operator - evaluates to false if the variables on either side of the operator
point to the same object and true otherwise
In [4]:
b = 15.6
if (type(b) is not float):
print ("true")
else:
print ("false") # returns false because the data type of 'b' is 'float' not 'int'
false
Membership Operators
Membership operators are operators used to validate the membership of a value in a sequence
The membership operators are 'in' and 'not in'
In [5]:
x = [1,2,3,4,5]
True
‘not in’ operator - evaluates to true if it does not find a variable in the specified
sequence and false otherwise
In [6]:
y = [1,2,3,4,5]
True
localhost:8888/notebooks/Desktop/Operators.ipynb 2/3
4/19/2020 Operators - Jupyter Notebook
Bitwise Operators
END OF SCRIPT
localhost:8888/notebooks/Desktop/Operators.ipynb 3/3