SlideShare a Scribd company logo
1 of 32
Download to read offline
The Linux command line Writing and running Python code Next meetings
Big Data and Automated Content Analysis
Week 1 – Wednesday
»First steps in the VM«
Damian Trilling
d.c.trilling@uva.nl
@damian0604
www.damiantrilling.net
Afdeling Communicatiewetenschap
Universiteit van Amsterdam
7 February 2018
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Today
1 The Linux command line
2 Writing and running Python code
3 Next meetings
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
When point-and-click doesn’t help you further:
The Linux command line
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
The tools
General idea
Whereever possbile, we use tools that are
• platform-independent
• free (as in beer and as in speech)
• open source
.
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
The tools
General idea
Whereever possbile, we use tools that are
• platform-independent
• free (as in beer and as in speech)
• open source
To make things easier, we work with a virtual machine in which
everyone runs the same Linux version.
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Let’s switch to Linux!
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Tools: The linux command line
a.k.a. the terminal, shell or, more specifically, bash
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Tools: The linux command line
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Tools: The linux command line
Why?
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Tools: The linux command line
Why?
• Direct access to your computer’s functions
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Tools: The linux command line
Why?
• Direct access to your computer’s functions
• In contrast to point-and-click programs, command line
programs can easily be linked to each other, scripted, . . .
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Tools: The linux command line
Why?
• Direct access to your computer’s functions
• In contrast to point-and-click programs, command line
programs can easily be linked to each other, scripted, . . .
• Suitable for handling even huge files
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Tools: The linux command line
Why?
• Direct access to your computer’s functions
• In contrast to point-and-click programs, command line
programs can easily be linked to each other, scripted, . . .
• Suitable for handling even huge files
• You simply cannot open them in many GUI programs
• . . . or it takes ages
• The command line allows you to do such things without
problems
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Tools: The linux command line
Why?
• Direct access to your computer’s functions
• In contrast to point-and-click programs, command line
programs can easily be linked to each other, scripted, . . .
• Suitable for handling even huge files
• You simply cannot open them in many GUI programs
• . . . or it takes ages
• The command line allows you to do such things without
problems
• It is reproducible (ever tried to explain to your parents on the
phone where they have to click?)
Big Data and Automated Content Analysis Damian Trilling
There are endless tutorials, cheat
sheets, videos . . . online. Google it!
The Linux command line Writing and running Python code Next meetings
Exercise
Take the book.
Follow the instructions in Chapter 2.
Observe how you could do the same thing with the graphical
interface.
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
A language, not a program:
Python
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Python
What?
• A language, not a specific program
• Huge advantage: flexibility, portability
• One of the languages for data analysis. (The other one is R.)
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Python
What?
• A language, not a specific program
• Huge advantage: flexibility, portability
• One of the languages for data analysis. (The other one is R.)
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Python
What?
• A language, not a specific program
• Huge advantage: flexibility, portability
• One of the languages for data analysis. (The other one is R.)
Which version?
We use Python 3.
http://www.google.com or http://www.stackexchange.com still offer a lot
of Python2-code, but that can easily be adapted. Most notable difference: In
Python 2, you write print "Hi", this has changed to print ("Hi")
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
If it’s not a program, how do you work with it?
Interactive mode
• Just type ipython3 (if not available: python3)on the
command line, and you can start entering Python commands
(You can leave again by entering quit())
• Great for quick try-outs, but you cannot even save your code
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
If it’s not a program, how do you work with it?
Interactive mode
• Just type ipython3 (if not available: python3)on the
command line, and you can start entering Python commands
(You can leave again by entering quit())
• Great for quick try-outs, but you cannot even save your code
An editor of your choice
• Write your program in any text editor, save it as myprog.py
• and run it from the command line with ./myprog.py or
python3 myprog.py
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
If it’s not a program, how do you start it?
An IDE (Integrated Development Environment)
• Provides an interface
• Both quick interactive try-outs and writing larger programs
• We use spyder, which looks a bit like RStudio (and to some
extent like Stata)
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
If it’s not a program, how do you start it?
An IDE (Integrated Development Environment)
• Provides an interface
• Both quick interactive try-outs and writing larger programs
• We use spyder, which looks a bit like RStudio (and to some
extent like Stata)
Jupyter Notebook
• Runs in your browser
• Stores results and text along with code
• Great for interactive playing with data and for sharing results
Big Data and Automated Content Analysis Damian Trilling
Let’s start up a Python environment and write a
Hello-world-program!
The Linux command line Writing and running Python code Next meetings
Start playing!
1. Run a program that greets you.
The code for this is
1 print("Hello world")
After that, do some calculations. You can do that in a similar way:
1 a=2
2 print(a*3)
Just play around.
Repeat your exercise in different environments (command line
shell, spyder, jupyter notebook).
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Start playing!
2. Write a program that converts centimeters to inches
Take a variable with the number of centimeters as input and print
a nicely formatted answer that gives the value in inches. 1 inch =
2.54 cm.
Printing several things in a row can be done like this:
1 print("The answer is",42)
Additional ressources
Codecademy course on Python
https://www.codecademy.com/learn/python
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Next meetings
Big Data and Automated Content Analysis Damian Trilling
The Linux command line Writing and running Python code Next meetings
Week 2: Getting started with Python
Monday, 12–2
Lecture.
Chapter 4.
Wednesday, 14–2
Lab Session.
Exercise A1.
Big Data and Automated Content Analysis Damian Trilling

More Related Content

What's hot

Towards a Census of Free and Open Source Licenses
Towards a Census of Free and Open Source LicensesTowards a Census of Free and Open Source Licenses
Towards a Census of Free and Open Source Licensesdmgerman
 
Python for DevOps use
Python for DevOps usePython for DevOps use
Python for DevOps useRitesh Gupta
 
OSDC 2019 | Terraform best practices with examples and arguments by Anton Bab...
OSDC 2019 | Terraform best practices with examples and arguments by Anton Bab...OSDC 2019 | Terraform best practices with examples and arguments by Anton Bab...
OSDC 2019 | Terraform best practices with examples and arguments by Anton Bab...NETWAYS
 
What is Python? | Edureka
What is Python? | EdurekaWhat is Python? | Edureka
What is Python? | EdurekaEdureka!
 
Improving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis codeImproving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis codeJohan Carlin
 
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017Codemotion
 
Python programming
Python programmingPython programming
Python programmingMegha V
 
An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1Blue Elephant Consulting
 

What's hot (10)

Towards a Census of Free and Open Source Licenses
Towards a Census of Free and Open Source LicensesTowards a Census of Free and Open Source Licenses
Towards a Census of Free and Open Source Licenses
 
Python for DevOps use
Python for DevOps usePython for DevOps use
Python for DevOps use
 
OSDC 2019 | Terraform best practices with examples and arguments by Anton Bab...
OSDC 2019 | Terraform best practices with examples and arguments by Anton Bab...OSDC 2019 | Terraform best practices with examples and arguments by Anton Bab...
OSDC 2019 | Terraform best practices with examples and arguments by Anton Bab...
 
What is Python? | Edureka
What is Python? | EdurekaWhat is Python? | Edureka
What is Python? | Edureka
 
Improving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis codeImproving the accuracy and reliability of data analysis code
Improving the accuracy and reliability of data analysis code
 
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
How to write maintainable code - Peter Hilton - Codemotion Amsterdam 2017
 
Flock 2017-g11n
Flock 2017-g11nFlock 2017-g11n
Flock 2017-g11n
 
Illustrated Code (ASE 2021)
Illustrated Code (ASE 2021)Illustrated Code (ASE 2021)
Illustrated Code (ASE 2021)
 
Python programming
Python programmingPython programming
Python programming
 
An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1An Introduction To Software Development - Test Driven Development, Part 1
An Introduction To Software Development - Test Driven Development, Part 1
 

Similar to BDACA - Tutorial1

Py4 inf 01-intro
Py4 inf 01-introPy4 inf 01-intro
Py4 inf 01-introIshaq Ali
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners Sujith Kumar
 
Python and its Applications
Python and its ApplicationsPython and its Applications
Python and its ApplicationsAbhijeet Singh
 
Pythonanditsapplications 161121160425
Pythonanditsapplications 161121160425Pythonanditsapplications 161121160425
Pythonanditsapplications 161121160425Sapna Tyagi
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyTIB Academy
 
intro.pptx (1).pdf
intro.pptx (1).pdfintro.pptx (1).pdf
intro.pptx (1).pdfANIKULSAIKH
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming LanguagePython Tutorial | Python Programming Language
Python Tutorial | Python Programming Languageanaveenkumar4
 
Basic Python Introduction Lecture 1.pptx
Basic Python Introduction Lecture 1.pptxBasic Python Introduction Lecture 1.pptx
Basic Python Introduction Lecture 1.pptxAditya Patel
 
Introduction to Python.pdf
Introduction to Python.pdfIntroduction to Python.pdf
Introduction to Python.pdfRahul Mogal
 
Python Introduction its a oop language and easy to use
Python Introduction its a oop language and easy to usePython Introduction its a oop language and easy to use
Python Introduction its a oop language and easy to useSrajanCollege1
 
python programming.pptx
python programming.pptxpython programming.pptx
python programming.pptxKaviya452563
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptxArpittripathi45
 
Phython Programming Language
Phython Programming LanguagePhython Programming Language
Phython Programming LanguageR.h. Himel
 

Similar to BDACA - Tutorial1 (20)

BDACA1617s2 - Tutorial 1
BDACA1617s2 - Tutorial 1BDACA1617s2 - Tutorial 1
BDACA1617s2 - Tutorial 1
 
BD-ACA week1a
BD-ACA week1aBD-ACA week1a
BD-ACA week1a
 
MODULE 1.pptx
MODULE 1.pptxMODULE 1.pptx
MODULE 1.pptx
 
Py4 inf 01-intro
Py4 inf 01-introPy4 inf 01-intro
Py4 inf 01-intro
 
Python Programming Draft PPT.pptx
Python Programming Draft PPT.pptxPython Programming Draft PPT.pptx
Python Programming Draft PPT.pptx
 
Introduction to python for Beginners
Introduction to python for Beginners Introduction to python for Beginners
Introduction to python for Beginners
 
Introduction python
Introduction pythonIntroduction python
Introduction python
 
Python and its Applications
Python and its ApplicationsPython and its Applications
Python and its Applications
 
Pythonanditsapplications 161121160425
Pythonanditsapplications 161121160425Pythonanditsapplications 161121160425
Pythonanditsapplications 161121160425
 
Python tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academyPython tutorial for beginners - Tib academy
Python tutorial for beginners - Tib academy
 
intro.pptx (1).pdf
intro.pptx (1).pdfintro.pptx (1).pdf
intro.pptx (1).pdf
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
 
Python Tutorial | Python Programming Language
Python Tutorial | Python Programming LanguagePython Tutorial | Python Programming Language
Python Tutorial | Python Programming Language
 
Basic Python Introduction Lecture 1.pptx
Basic Python Introduction Lecture 1.pptxBasic Python Introduction Lecture 1.pptx
Basic Python Introduction Lecture 1.pptx
 
Introduction to Python.pdf
Introduction to Python.pdfIntroduction to Python.pdf
Introduction to Python.pdf
 
Python Introduction its a oop language and easy to use
Python Introduction its a oop language and easy to usePython Introduction its a oop language and easy to use
Python Introduction its a oop language and easy to use
 
py4inf-01-intro.ppt
py4inf-01-intro.pptpy4inf-01-intro.ppt
py4inf-01-intro.ppt
 
python programming.pptx
python programming.pptxpython programming.pptx
python programming.pptx
 
python presntation 2.pptx
python presntation 2.pptxpython presntation 2.pptx
python presntation 2.pptx
 
Phython Programming Language
Phython Programming LanguagePhython Programming Language
Phython Programming Language
 

More from Department of Communication Science, University of Amsterdam

More from Department of Communication Science, University of Amsterdam (20)

BDACA - Lecture8
BDACA - Lecture8BDACA - Lecture8
BDACA - Lecture8
 
BDACA - Lecture7
BDACA - Lecture7BDACA - Lecture7
BDACA - Lecture7
 
BDACA - Lecture6
BDACA - Lecture6BDACA - Lecture6
BDACA - Lecture6
 
BDACA - Tutorial5
BDACA - Tutorial5BDACA - Tutorial5
BDACA - Tutorial5
 
BDACA - Lecture5
BDACA - Lecture5BDACA - Lecture5
BDACA - Lecture5
 
BDACA - Lecture4
BDACA - Lecture4BDACA - Lecture4
BDACA - Lecture4
 
BDACA - Lecture3
BDACA - Lecture3BDACA - Lecture3
BDACA - Lecture3
 
BDACA - Lecture2
BDACA - Lecture2BDACA - Lecture2
BDACA - Lecture2
 
BDACA - Lecture1
BDACA - Lecture1BDACA - Lecture1
BDACA - Lecture1
 
BDACA1617s2 - Lecture7
BDACA1617s2 - Lecture7BDACA1617s2 - Lecture7
BDACA1617s2 - Lecture7
 
BDACA1617s2 - Lecture6
BDACA1617s2 - Lecture6BDACA1617s2 - Lecture6
BDACA1617s2 - Lecture6
 
BDACA1617s2 - Lecture5
BDACA1617s2 - Lecture5BDACA1617s2 - Lecture5
BDACA1617s2 - Lecture5
 
BDACA1617s2 - Lecture4
BDACA1617s2 - Lecture4BDACA1617s2 - Lecture4
BDACA1617s2 - Lecture4
 
BDACA1617s2 - Lecture3
BDACA1617s2 - Lecture3BDACA1617s2 - Lecture3
BDACA1617s2 - Lecture3
 
BDACA1617s2 - Lecture 2
BDACA1617s2 - Lecture 2BDACA1617s2 - Lecture 2
BDACA1617s2 - Lecture 2
 
BDACA1617s2 - Lecture 1
BDACA1617s2 - Lecture 1BDACA1617s2 - Lecture 1
BDACA1617s2 - Lecture 1
 
Media diets in an age of apps and social media: Dealing with a third layer of...
Media diets in an age of apps and social media: Dealing with a third layer of...Media diets in an age of apps and social media: Dealing with a third layer of...
Media diets in an age of apps and social media: Dealing with a third layer of...
 
Conceptualizing and measuring news exposure as network of users and news items
Conceptualizing and measuring news exposure as network of users and news itemsConceptualizing and measuring news exposure as network of users and news items
Conceptualizing and measuring news exposure as network of users and news items
 
Data Science: Case "Political Communication 2/2"
Data Science: Case "Political Communication 2/2"Data Science: Case "Political Communication 2/2"
Data Science: Case "Political Communication 2/2"
 
Data Science: Case "Political Communication 1/2"
Data Science: Case "Political Communication 1/2"Data Science: Case "Political Communication 1/2"
Data Science: Case "Political Communication 1/2"
 

Recently uploaded

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxheathfieldcps1
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsanshu789521
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesFatimaKhan178732
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingTechSoup
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeThiyagu K
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...EduSkills OECD
 

Recently uploaded (20)

Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
The basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptxThe basics of sentences session 2pptx copy.pptx
The basics of sentences session 2pptx copy.pptx
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Presiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha electionsPresiding Officer Training module 2024 lok sabha elections
Presiding Officer Training module 2024 lok sabha elections
 
Separation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and ActinidesSeparation of Lanthanides/ Lanthanides and Actinides
Separation of Lanthanides/ Lanthanides and Actinides
 
Grant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy ConsultingGrant Readiness 101 TechSoup and Remy Consulting
Grant Readiness 101 TechSoup and Remy Consulting
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Measures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and ModeMeasures of Central Tendency: Mean, Median and Mode
Measures of Central Tendency: Mean, Median and Mode
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
Presentation by Andreas Schleicher Tackling the School Absenteeism Crisis 30 ...
 

BDACA - Tutorial1

  • 1. The Linux command line Writing and running Python code Next meetings Big Data and Automated Content Analysis Week 1 – Wednesday »First steps in the VM« Damian Trilling d.c.trilling@uva.nl @damian0604 www.damiantrilling.net Afdeling Communicatiewetenschap Universiteit van Amsterdam 7 February 2018 Big Data and Automated Content Analysis Damian Trilling
  • 2. The Linux command line Writing and running Python code Next meetings Today 1 The Linux command line 2 Writing and running Python code 3 Next meetings Big Data and Automated Content Analysis Damian Trilling
  • 3. The Linux command line Writing and running Python code Next meetings When point-and-click doesn’t help you further: The Linux command line Big Data and Automated Content Analysis Damian Trilling
  • 4. The Linux command line Writing and running Python code Next meetings The tools General idea Whereever possbile, we use tools that are • platform-independent • free (as in beer and as in speech) • open source . Big Data and Automated Content Analysis Damian Trilling
  • 5. The Linux command line Writing and running Python code Next meetings The tools General idea Whereever possbile, we use tools that are • platform-independent • free (as in beer and as in speech) • open source To make things easier, we work with a virtual machine in which everyone runs the same Linux version. Big Data and Automated Content Analysis Damian Trilling
  • 6.
  • 7. The Linux command line Writing and running Python code Next meetings Let’s switch to Linux! Big Data and Automated Content Analysis Damian Trilling
  • 8. The Linux command line Writing and running Python code Next meetings Tools: The linux command line a.k.a. the terminal, shell or, more specifically, bash Big Data and Automated Content Analysis Damian Trilling
  • 9. The Linux command line Writing and running Python code Next meetings Tools: The linux command line Big Data and Automated Content Analysis Damian Trilling
  • 10. The Linux command line Writing and running Python code Next meetings Tools: The linux command line Why? Big Data and Automated Content Analysis Damian Trilling
  • 11. The Linux command line Writing and running Python code Next meetings Tools: The linux command line Why? • Direct access to your computer’s functions Big Data and Automated Content Analysis Damian Trilling
  • 12. The Linux command line Writing and running Python code Next meetings Tools: The linux command line Why? • Direct access to your computer’s functions • In contrast to point-and-click programs, command line programs can easily be linked to each other, scripted, . . . Big Data and Automated Content Analysis Damian Trilling
  • 13. The Linux command line Writing and running Python code Next meetings Tools: The linux command line Why? • Direct access to your computer’s functions • In contrast to point-and-click programs, command line programs can easily be linked to each other, scripted, . . . • Suitable for handling even huge files Big Data and Automated Content Analysis Damian Trilling
  • 14. The Linux command line Writing and running Python code Next meetings Tools: The linux command line Why? • Direct access to your computer’s functions • In contrast to point-and-click programs, command line programs can easily be linked to each other, scripted, . . . • Suitable for handling even huge files • You simply cannot open them in many GUI programs • . . . or it takes ages • The command line allows you to do such things without problems Big Data and Automated Content Analysis Damian Trilling
  • 15. The Linux command line Writing and running Python code Next meetings Tools: The linux command line Why? • Direct access to your computer’s functions • In contrast to point-and-click programs, command line programs can easily be linked to each other, scripted, . . . • Suitable for handling even huge files • You simply cannot open them in many GUI programs • . . . or it takes ages • The command line allows you to do such things without problems • It is reproducible (ever tried to explain to your parents on the phone where they have to click?) Big Data and Automated Content Analysis Damian Trilling
  • 16. There are endless tutorials, cheat sheets, videos . . . online. Google it!
  • 17. The Linux command line Writing and running Python code Next meetings Exercise Take the book. Follow the instructions in Chapter 2. Observe how you could do the same thing with the graphical interface. Big Data and Automated Content Analysis Damian Trilling
  • 18. The Linux command line Writing and running Python code Next meetings A language, not a program: Python Big Data and Automated Content Analysis Damian Trilling
  • 19. The Linux command line Writing and running Python code Next meetings Python What? • A language, not a specific program • Huge advantage: flexibility, portability • One of the languages for data analysis. (The other one is R.) Big Data and Automated Content Analysis Damian Trilling
  • 20. The Linux command line Writing and running Python code Next meetings Python What? • A language, not a specific program • Huge advantage: flexibility, portability • One of the languages for data analysis. (The other one is R.) Big Data and Automated Content Analysis Damian Trilling
  • 21. The Linux command line Writing and running Python code Next meetings Python What? • A language, not a specific program • Huge advantage: flexibility, portability • One of the languages for data analysis. (The other one is R.) Which version? We use Python 3. http://www.google.com or http://www.stackexchange.com still offer a lot of Python2-code, but that can easily be adapted. Most notable difference: In Python 2, you write print "Hi", this has changed to print ("Hi") Big Data and Automated Content Analysis Damian Trilling
  • 22. The Linux command line Writing and running Python code Next meetings If it’s not a program, how do you work with it? Interactive mode • Just type ipython3 (if not available: python3)on the command line, and you can start entering Python commands (You can leave again by entering quit()) • Great for quick try-outs, but you cannot even save your code Big Data and Automated Content Analysis Damian Trilling
  • 23. The Linux command line Writing and running Python code Next meetings If it’s not a program, how do you work with it? Interactive mode • Just type ipython3 (if not available: python3)on the command line, and you can start entering Python commands (You can leave again by entering quit()) • Great for quick try-outs, but you cannot even save your code An editor of your choice • Write your program in any text editor, save it as myprog.py • and run it from the command line with ./myprog.py or python3 myprog.py Big Data and Automated Content Analysis Damian Trilling
  • 24. The Linux command line Writing and running Python code Next meetings If it’s not a program, how do you start it? An IDE (Integrated Development Environment) • Provides an interface • Both quick interactive try-outs and writing larger programs • We use spyder, which looks a bit like RStudio (and to some extent like Stata) Big Data and Automated Content Analysis Damian Trilling
  • 25. The Linux command line Writing and running Python code Next meetings If it’s not a program, how do you start it? An IDE (Integrated Development Environment) • Provides an interface • Both quick interactive try-outs and writing larger programs • We use spyder, which looks a bit like RStudio (and to some extent like Stata) Jupyter Notebook • Runs in your browser • Stores results and text along with code • Great for interactive playing with data and for sharing results Big Data and Automated Content Analysis Damian Trilling
  • 26.
  • 27.
  • 28. Let’s start up a Python environment and write a Hello-world-program!
  • 29. The Linux command line Writing and running Python code Next meetings Start playing! 1. Run a program that greets you. The code for this is 1 print("Hello world") After that, do some calculations. You can do that in a similar way: 1 a=2 2 print(a*3) Just play around. Repeat your exercise in different environments (command line shell, spyder, jupyter notebook). Big Data and Automated Content Analysis Damian Trilling
  • 30. The Linux command line Writing and running Python code Next meetings Start playing! 2. Write a program that converts centimeters to inches Take a variable with the number of centimeters as input and print a nicely formatted answer that gives the value in inches. 1 inch = 2.54 cm. Printing several things in a row can be done like this: 1 print("The answer is",42) Additional ressources Codecademy course on Python https://www.codecademy.com/learn/python Big Data and Automated Content Analysis Damian Trilling
  • 31. The Linux command line Writing and running Python code Next meetings Next meetings Big Data and Automated Content Analysis Damian Trilling
  • 32. The Linux command line Writing and running Python code Next meetings Week 2: Getting started with Python Monday, 12–2 Lecture. Chapter 4. Wednesday, 14–2 Lab Session. Exercise A1. Big Data and Automated Content Analysis Damian Trilling