Why and How I forced
myself to learn Python
Main Purpose: Open the gate to
Python
• Try to address 2 main difficulties:
1) How to start
2) How to solve problems
• Some experience sharing that may apply all the time
• Not to replace formal python training
Not much detail to remember.
Hope you have fun
Why PYTHON?
• Source
Why PYTHON?
• Free
• Massive Communities
• Massive libraries
• Massive open sources
• Most popular programming
language in the AI/Deep
Learning era.
First Thing: setting up environment
• Option 1: Setup your own env by installing a bunch of things: IDEs,
Libraries, Virtual Envs and so on.
• Shortcut: Nothing to install with ANZ Data Analytics Platform using
IBM Cloud Pak for Data (CP4D).
• Create a project
• Add “notebook”
• Here you go!
• Video: Create a project
2 Good Enough Knowledge to start
to understand python code
1) Code block is defined by indention!
2) Colon( : ) is start of a new block in many constructs, e.g. function definitions, if clauses
Start from learn/modify existing
code
• Import libraries
• Define a function
• How to comment
• How to define a variable
• How to print
How to solve problems:
Google Search -> Copy -> Paste -> Try
• Search when you don’t how to
do, example:
• “python operator logical not equal”
• “python dataframe replace column
name”
• Search when you don’t
understand the code,
example:
• 'c' in a
You can search a way more…
• When I was having Network issues, I found:
• When I tried to evaluate Watson Performance on NLP and I found:
https://github.com/kavgan/nlp-in-practice
• Source
• >15%
• Keep
increasing
Most important Library – pandas
An example Pandas dataframe <-> Database Table
source
Enough to Understand the Code
· Indentation matters to code meaning
• Block structure indicated by indentation
· First assignment to a variable creates it
• Variable types don’t need to be declared.
• Python figures out the variable types on its own.
· Assignment is = and comparison is ==
· For numbers + - * / % are as expected
• Special use of + for string concatenation and % for
string formatting (as in C’s printf)
· Logical operators are words (and, or,
not) not symbols
· The basic printing command is print
Most important function: print
• Grammar: print()
• A string: print(’hello world’)
• print Item1, Item2, ..., ItemN