SlideShare a Scribd company logo
1 of 26
Download to read offline
Basics Exercise Next meetings
Big Data and Automated Content Analysis
Week 2 – Wednesday
»Getting started with Python«
Damian Trilling
d.c.trilling@uva.nl
@damian0604
www.damiantrilling.net
Afdeling Communicatiewetenschap
Universiteit van Amsterdam
8 April 2014
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Today
1 The very, very, basics of programming with Python
Datatypes
Indention: The Python way of structuring your program
2 Exercise
3 Next meetings
Big Data and Automated Content Analysis Damian Trilling
The very, very, basics of programming
You’ve read all this in chapter 3.
Basics Exercise Next meetings
Datatypes
Python lingo
Basic datatypes (variables)
int 32
float 1.75
bool True, False
string "Damian"
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Datatypes
Python lingo
Basic datatypes (variables)
int 32
float 1.75
bool True, False
string "Damian"
"5" and 5 is not the same.
But you can transform it: int("5") will return 5.
You cannot calculate 3 * "5".
But you can calculate 3 * int("5")
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Datatypes
Python lingo
More advanced datatypes
Note that the elements of a list, the keys of a dict, and the values
of a dict can have any datatype! (It should be consistent, though!)
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Datatypes
Python lingo
More advanced datatypes
list firstnames = [’Damian’,’Lori’,’Bjoern’]
lastnames =
[’Trilling’,’Meester’,’Burscher’]
Note that the elements of a list, the keys of a dict, and the values
of a dict can have any datatype! (It should be consistent, though!)
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Datatypes
Python lingo
More advanced datatypes
list firstnames = [’Damian’,’Lori’,’Bjoern’]
lastnames =
[’Trilling’,’Meester’,’Burscher’]
list ages = [18,22,45,23]
Note that the elements of a list, the keys of a dict, and the values
of a dict can have any datatype! (It should be consistent, though!)
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Datatypes
Python lingo
More advanced datatypes
list firstnames = [’Damian’,’Lori’,’Bjoern’]
lastnames =
[’Trilling’,’Meester’,’Burscher’]
list ages = [18,22,45,23]
dict familynames= {’Bjoern’: ’Burscher’,
’Damian’: ’Trilling’, ’Lori’: ’Meester’}
dict {’Bjoern’: 26, ’Damian’: 31, ’Lori’:
25}
Note that the elements of a list, the keys of a dict, and the values
of a dict can have any datatype! (It should be consistent, though!)
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Datatypes
Python lingo
Functions
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Datatypes
Python lingo
Functions
functions Take an input and return something else
int(32.43) returns the integer 32. len("Hello")
returns the integer 5.
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Datatypes
Python lingo
Functions
functions Take an input and return something else
int(32.43) returns the integer 32. len("Hello")
returns the integer 5.
methods are similar to functions, but directly associated with
an object. "SCREAM".lower() returns the string
"scream"
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Datatypes
Python lingo
Functions
functions Take an input and return something else
int(32.43) returns the integer 32. len("Hello")
returns the integer 5.
methods are similar to functions, but directly associated with
an object. "SCREAM".lower() returns the string
"scream"
Both functions and methods end with (). Between the (),
arguments can (sometimes have to) be supplied.
Big Data and Automated Content Analysis Damian Trilling
Indention: The Python way of structuring your program
Basics Exercise Next meetings
Indention
Indention
Structure
The program is structured by TABs or SPACEs
1 firstnames=[’Damian’,’Lori’,’Bjoern’]
2 age={’Bjoern’: 27, ’Damian’: 32, ’Lori’: 26}
3 print ("The names and ages of all BigData people:")
4 for naam in firstnames:
5 print (naam,age[naam])
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Indention
Indention
Structure
The program is structured by TABs or SPACEs
1 firstnames=[’Damian’,’Lori’,’Bjoern’]
2 age={’Bjoern’: 27, ’Damian’: 32, ’Lori’: 26}
3 print ("The names and ages of all BigData people:")
4 for naam in firstnames:
5 print (naam,age[naam])
Don’t mix up TABs and spaces! Both are valid, but you have
to be consequent!!!
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Indention
Indention
Structure
The program is structured by TABs or SPACEs
1 print ("The names and ages of all BigData people:")
2 for naam in firstnames:
3 print (naam,age[naam])
4 if naam=="Damian":
5 print ("He teaches this course")
6 elif naam=="Lori":
7 print ("She was an assistant last year")
8 elif naam=="Bjoern":
9 print ("He helps on Wednesdays")
10 else:
11 print ("No idea who this is")
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Indention
Indention
The line before an indented block starts with a statement
indicating what should be done with the block and ends with a :
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Indention
Indention
The line before an indented block starts with a statement
indicating what should be done with the block and ends with a :
Indention of the block indicates that
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Indention
Indention
The line before an indented block starts with a statement
indicating what should be done with the block and ends with a :
Indention of the block indicates that
• it is to be executed repeatedly (for statement) – e.g., for
each element from a list
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Indention
Indention
The line before an indented block starts with a statement
indicating what should be done with the block and ends with a :
Indention of the block indicates that
• it is to be executed repeatedly (for statement) – e.g., for
each element from a list
• it is only to be executed under specific conditions (if, elif,
and else statements)
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Indention
Indention
The line before an indented block starts with a statement
indicating what should be done with the block and ends with a :
Indention of the block indicates that
• it is to be executed repeatedly (for statement) – e.g., for
each element from a list
• it is only to be executed under specific conditions (if, elif,
and else statements)
• an alternative block should be executed if an error occurs
(try and except statements)
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Indention
Indention
The line before an indented block starts with a statement
indicating what should be done with the block and ends with a :
Indention of the block indicates that
• it is to be executed repeatedly (for statement) – e.g., for
each element from a list
• it is only to be executed under specific conditions (if, elif,
and else statements)
• an alternative block should be executed if an error occurs
(try and except statements)
• a file is opened, but should be closed again after the block has
been executed (with statement)
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
We’ll now together do the exercise “Describing an existing
structured dataset”.
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Next meetings
Big Data and Automated Content Analysis Damian Trilling
Basics Exercise Next meetings
Week 3: Data harvesting and storage
Monday, 13–4
A conceptual overview of APIs, scrapers, crawlers, RSS-feeds,
databases, and different file formats
Wednesday, 15–4
Writing some first data collection scripts
Preparation
• Conceptual level: Read the article by Morstatter, Pfeffer, Liu,
and Carley (2013) about the limitations of the Twitter API.
• Technical level: Make sure you are comfortable with the
techniques we’ve covered so far. Play around. Give
yourself some tasks and solve them. Google.
Big Data and Automated Content Analysis Damian Trilling

More Related Content

What's hot

Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning ParrotAI
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data AnalyticsEdureka!
 
Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming LanguageTahani Al-Manie
 
Ground Gurus - Python Code Camp - Day 3 - Classes
Ground Gurus - Python Code Camp - Day 3 - ClassesGround Gurus - Python Code Camp - Day 3 - Classes
Ground Gurus - Python Code Camp - Day 3 - ClassesChariza Pladin
 
Introduction To Programming with Python
Introduction To Programming with PythonIntroduction To Programming with Python
Introduction To Programming with PythonSushant Mane
 

What's hot (20)

BDACA1516s2 - Lecture6
BDACA1516s2 - Lecture6BDACA1516s2 - Lecture6
BDACA1516s2 - Lecture6
 
BDACA - Lecture5
BDACA - Lecture5BDACA - Lecture5
BDACA - Lecture5
 
BDACA1516s2 - Lecture8
BDACA1516s2 - Lecture8BDACA1516s2 - Lecture8
BDACA1516s2 - Lecture8
 
BDACA1617s2 - Lecture5
BDACA1617s2 - Lecture5BDACA1617s2 - Lecture5
BDACA1617s2 - Lecture5
 
BDACA1617s2 - Lecture7
BDACA1617s2 - Lecture7BDACA1617s2 - Lecture7
BDACA1617s2 - Lecture7
 
BDACA1617s2 - Lecture6
BDACA1617s2 - Lecture6BDACA1617s2 - Lecture6
BDACA1617s2 - Lecture6
 
BD-ACA week3a
BD-ACA week3aBD-ACA week3a
BD-ACA week3a
 
BD-ACA week5
BD-ACA week5BD-ACA week5
BD-ACA week5
 
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
Python for Big Data Analytics
Python for Big Data AnalyticsPython for Big Data Analytics
Python for Big Data Analytics
 
Python45 2
Python45 2Python45 2
Python45 2
 
Python training
Python trainingPython training
Python training
 
Python 3 Programming Language
Python 3 Programming LanguagePython 3 Programming Language
Python 3 Programming Language
 
Python ppt
Python pptPython ppt
Python ppt
 
Ground Gurus - Python Code Camp - Day 3 - Classes
Ground Gurus - Python Code Camp - Day 3 - ClassesGround Gurus - Python Code Camp - Day 3 - Classes
Ground Gurus - Python Code Camp - Day 3 - Classes
 
Pa1 session 2
Pa1 session 2 Pa1 session 2
Pa1 session 2
 
Introduction To Programming with Python
Introduction To Programming with PythonIntroduction To Programming with Python
Introduction To Programming with Python
 
Python programming l2
Python programming l2Python programming l2
Python programming l2
 
Python Tutorial Part 1
Python Tutorial Part 1Python Tutorial Part 1
Python Tutorial Part 1
 

Similar to Python Basics for Automated Content Analysis

Coding in Kotlin with Arrow NIDC 2018
Coding in Kotlin with Arrow NIDC 2018Coding in Kotlin with Arrow NIDC 2018
Coding in Kotlin with Arrow NIDC 2018Garth Gilmour
 
These questions will be a bit advanced level 2
These questions will be a bit advanced level 2These questions will be a bit advanced level 2
These questions will be a bit advanced level 2sadhana312471
 
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...amit kuraria
 
manish python.pptx
manish python.pptxmanish python.pptx
manish python.pptxssuser92d141
 
A Gentle Introduction to Coding ... with Python
A Gentle Introduction to Coding ... with PythonA Gentle Introduction to Coding ... with Python
A Gentle Introduction to Coding ... with PythonTariq Rashid
 
James Jesus Bermas on Crash Course on Python
James Jesus Bermas on Crash Course on PythonJames Jesus Bermas on Crash Course on Python
James Jesus Bermas on Crash Course on PythonCP-Union
 
What is ATT&CK coverage, anyway? Breadth and depth analysis with Atomic Red Team
What is ATT&CK coverage, anyway? Breadth and depth analysis with Atomic Red TeamWhat is ATT&CK coverage, anyway? Breadth and depth analysis with Atomic Red Team
What is ATT&CK coverage, anyway? Breadth and depth analysis with Atomic Red TeamMITRE ATT&CK
 
Programming in Python
Programming in Python Programming in Python
Programming in Python Tiji Thomas
 
An Introduction To Python - Final Exam Review
An Introduction To Python - Final Exam ReviewAn Introduction To Python - Final Exam Review
An Introduction To Python - Final Exam ReviewBlue Elephant Consulting
 
AmI 2015 - Python basics
AmI 2015 - Python basicsAmI 2015 - Python basics
AmI 2015 - Python basicsLuigi De Russis
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python amiable_indian
 

Similar to Python Basics for Automated Content Analysis (20)

BDACA - Lecture2
BDACA - Lecture2BDACA - Lecture2
BDACA - Lecture2
 
BDACA - Lecture3
BDACA - Lecture3BDACA - Lecture3
BDACA - Lecture3
 
Coding in Kotlin with Arrow NIDC 2018
Coding in Kotlin with Arrow NIDC 2018Coding in Kotlin with Arrow NIDC 2018
Coding in Kotlin with Arrow NIDC 2018
 
Python cheat-sheet
Python cheat-sheetPython cheat-sheet
Python cheat-sheet
 
These questions will be a bit advanced level 2
These questions will be a bit advanced level 2These questions will be a bit advanced level 2
These questions will be a bit advanced level 2
 
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
Write better python code with these 10 tricks | by yong cui, ph.d. | aug, 202...
 
BDACA1516s2 - Lecture7
BDACA1516s2 - Lecture7BDACA1516s2 - Lecture7
BDACA1516s2 - Lecture7
 
BDACA - Tutorial5
BDACA - Tutorial5BDACA - Tutorial5
BDACA - Tutorial5
 
BD-ACA week7a
BD-ACA week7aBD-ACA week7a
BD-ACA week7a
 
manish python.pptx
manish python.pptxmanish python.pptx
manish python.pptx
 
A Gentle Introduction to Coding ... with Python
A Gentle Introduction to Coding ... with PythonA Gentle Introduction to Coding ... with Python
A Gentle Introduction to Coding ... with Python
 
James Jesus Bermas on Crash Course on Python
James Jesus Bermas on Crash Course on PythonJames Jesus Bermas on Crash Course on Python
James Jesus Bermas on Crash Course on Python
 
Kavitha_python.ppt
Kavitha_python.pptKavitha_python.ppt
Kavitha_python.ppt
 
What is ATT&CK coverage, anyway? Breadth and depth analysis with Atomic Red Team
What is ATT&CK coverage, anyway? Breadth and depth analysis with Atomic Red TeamWhat is ATT&CK coverage, anyway? Breadth and depth analysis with Atomic Red Team
What is ATT&CK coverage, anyway? Breadth and depth analysis with Atomic Red Team
 
Programming in Python
Programming in Python Programming in Python
Programming in Python
 
An Introduction To Python - Final Exam Review
An Introduction To Python - Final Exam ReviewAn Introduction To Python - Final Exam Review
An Introduction To Python - Final Exam Review
 
AmI 2015 - Python basics
AmI 2015 - Python basicsAmI 2015 - Python basics
AmI 2015 - Python basics
 
Clean code
Clean codeClean code
Clean code
 
Introduction to Python
Introduction to Python Introduction to Python
Introduction to Python
 
Dynamic Python
Dynamic PythonDynamic Python
Dynamic Python
 

More from Department of Communication Science, University of Amsterdam

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

BDACA - Lecture8
BDACA - Lecture8BDACA - Lecture8
BDACA - Lecture8
 
BDACA - Lecture7
BDACA - Lecture7BDACA - Lecture7
BDACA - Lecture7
 
BDACA - Lecture6
BDACA - Lecture6BDACA - Lecture6
BDACA - Lecture6
 
BDACA - Lecture4
BDACA - Lecture4BDACA - Lecture4
BDACA - Lecture4
 
BDACA - Tutorial1
BDACA - Tutorial1BDACA - Tutorial1
BDACA - Tutorial1
 
BDACA - Lecture1
BDACA - Lecture1BDACA - Lecture1
BDACA - Lecture1
 
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"
 
BDACA1516s2 - Lecture4
 BDACA1516s2 - Lecture4 BDACA1516s2 - Lecture4
BDACA1516s2 - Lecture4
 
BDACA1516s2 - Lecture1
BDACA1516s2 - Lecture1BDACA1516s2 - Lecture1
BDACA1516s2 - Lecture1
 

Python Basics for Automated Content Analysis

  • 1. Basics Exercise Next meetings Big Data and Automated Content Analysis Week 2 – Wednesday »Getting started with Python« Damian Trilling d.c.trilling@uva.nl @damian0604 www.damiantrilling.net Afdeling Communicatiewetenschap Universiteit van Amsterdam 8 April 2014 Big Data and Automated Content Analysis Damian Trilling
  • 2. Basics Exercise Next meetings Today 1 The very, very, basics of programming with Python Datatypes Indention: The Python way of structuring your program 2 Exercise 3 Next meetings Big Data and Automated Content Analysis Damian Trilling
  • 3. The very, very, basics of programming You’ve read all this in chapter 3.
  • 4. Basics Exercise Next meetings Datatypes Python lingo Basic datatypes (variables) int 32 float 1.75 bool True, False string "Damian" Big Data and Automated Content Analysis Damian Trilling
  • 5. Basics Exercise Next meetings Datatypes Python lingo Basic datatypes (variables) int 32 float 1.75 bool True, False string "Damian" "5" and 5 is not the same. But you can transform it: int("5") will return 5. You cannot calculate 3 * "5". But you can calculate 3 * int("5") Big Data and Automated Content Analysis Damian Trilling
  • 6. Basics Exercise Next meetings Datatypes Python lingo More advanced datatypes Note that the elements of a list, the keys of a dict, and the values of a dict can have any datatype! (It should be consistent, though!) Big Data and Automated Content Analysis Damian Trilling
  • 7. Basics Exercise Next meetings Datatypes Python lingo More advanced datatypes list firstnames = [’Damian’,’Lori’,’Bjoern’] lastnames = [’Trilling’,’Meester’,’Burscher’] Note that the elements of a list, the keys of a dict, and the values of a dict can have any datatype! (It should be consistent, though!) Big Data and Automated Content Analysis Damian Trilling
  • 8. Basics Exercise Next meetings Datatypes Python lingo More advanced datatypes list firstnames = [’Damian’,’Lori’,’Bjoern’] lastnames = [’Trilling’,’Meester’,’Burscher’] list ages = [18,22,45,23] Note that the elements of a list, the keys of a dict, and the values of a dict can have any datatype! (It should be consistent, though!) Big Data and Automated Content Analysis Damian Trilling
  • 9. Basics Exercise Next meetings Datatypes Python lingo More advanced datatypes list firstnames = [’Damian’,’Lori’,’Bjoern’] lastnames = [’Trilling’,’Meester’,’Burscher’] list ages = [18,22,45,23] dict familynames= {’Bjoern’: ’Burscher’, ’Damian’: ’Trilling’, ’Lori’: ’Meester’} dict {’Bjoern’: 26, ’Damian’: 31, ’Lori’: 25} Note that the elements of a list, the keys of a dict, and the values of a dict can have any datatype! (It should be consistent, though!) Big Data and Automated Content Analysis Damian Trilling
  • 10. Basics Exercise Next meetings Datatypes Python lingo Functions Big Data and Automated Content Analysis Damian Trilling
  • 11. Basics Exercise Next meetings Datatypes Python lingo Functions functions Take an input and return something else int(32.43) returns the integer 32. len("Hello") returns the integer 5. Big Data and Automated Content Analysis Damian Trilling
  • 12. Basics Exercise Next meetings Datatypes Python lingo Functions functions Take an input and return something else int(32.43) returns the integer 32. len("Hello") returns the integer 5. methods are similar to functions, but directly associated with an object. "SCREAM".lower() returns the string "scream" Big Data and Automated Content Analysis Damian Trilling
  • 13. Basics Exercise Next meetings Datatypes Python lingo Functions functions Take an input and return something else int(32.43) returns the integer 32. len("Hello") returns the integer 5. methods are similar to functions, but directly associated with an object. "SCREAM".lower() returns the string "scream" Both functions and methods end with (). Between the (), arguments can (sometimes have to) be supplied. Big Data and Automated Content Analysis Damian Trilling
  • 14. Indention: The Python way of structuring your program
  • 15. Basics Exercise Next meetings Indention Indention Structure The program is structured by TABs or SPACEs 1 firstnames=[’Damian’,’Lori’,’Bjoern’] 2 age={’Bjoern’: 27, ’Damian’: 32, ’Lori’: 26} 3 print ("The names and ages of all BigData people:") 4 for naam in firstnames: 5 print (naam,age[naam]) Big Data and Automated Content Analysis Damian Trilling
  • 16. Basics Exercise Next meetings Indention Indention Structure The program is structured by TABs or SPACEs 1 firstnames=[’Damian’,’Lori’,’Bjoern’] 2 age={’Bjoern’: 27, ’Damian’: 32, ’Lori’: 26} 3 print ("The names and ages of all BigData people:") 4 for naam in firstnames: 5 print (naam,age[naam]) Don’t mix up TABs and spaces! Both are valid, but you have to be consequent!!! Big Data and Automated Content Analysis Damian Trilling
  • 17. Basics Exercise Next meetings Indention Indention Structure The program is structured by TABs or SPACEs 1 print ("The names and ages of all BigData people:") 2 for naam in firstnames: 3 print (naam,age[naam]) 4 if naam=="Damian": 5 print ("He teaches this course") 6 elif naam=="Lori": 7 print ("She was an assistant last year") 8 elif naam=="Bjoern": 9 print ("He helps on Wednesdays") 10 else: 11 print ("No idea who this is") Big Data and Automated Content Analysis Damian Trilling
  • 18. Basics Exercise Next meetings Indention Indention The line before an indented block starts with a statement indicating what should be done with the block and ends with a : Big Data and Automated Content Analysis Damian Trilling
  • 19. Basics Exercise Next meetings Indention Indention The line before an indented block starts with a statement indicating what should be done with the block and ends with a : Indention of the block indicates that Big Data and Automated Content Analysis Damian Trilling
  • 20. Basics Exercise Next meetings Indention Indention The line before an indented block starts with a statement indicating what should be done with the block and ends with a : Indention of the block indicates that • it is to be executed repeatedly (for statement) – e.g., for each element from a list Big Data and Automated Content Analysis Damian Trilling
  • 21. Basics Exercise Next meetings Indention Indention The line before an indented block starts with a statement indicating what should be done with the block and ends with a : Indention of the block indicates that • it is to be executed repeatedly (for statement) – e.g., for each element from a list • it is only to be executed under specific conditions (if, elif, and else statements) Big Data and Automated Content Analysis Damian Trilling
  • 22. Basics Exercise Next meetings Indention Indention The line before an indented block starts with a statement indicating what should be done with the block and ends with a : Indention of the block indicates that • it is to be executed repeatedly (for statement) – e.g., for each element from a list • it is only to be executed under specific conditions (if, elif, and else statements) • an alternative block should be executed if an error occurs (try and except statements) Big Data and Automated Content Analysis Damian Trilling
  • 23. Basics Exercise Next meetings Indention Indention The line before an indented block starts with a statement indicating what should be done with the block and ends with a : Indention of the block indicates that • it is to be executed repeatedly (for statement) – e.g., for each element from a list • it is only to be executed under specific conditions (if, elif, and else statements) • an alternative block should be executed if an error occurs (try and except statements) • a file is opened, but should be closed again after the block has been executed (with statement) Big Data and Automated Content Analysis Damian Trilling
  • 24. Basics Exercise Next meetings We’ll now together do the exercise “Describing an existing structured dataset”. Big Data and Automated Content Analysis Damian Trilling
  • 25. Basics Exercise Next meetings Next meetings Big Data and Automated Content Analysis Damian Trilling
  • 26. Basics Exercise Next meetings Week 3: Data harvesting and storage Monday, 13–4 A conceptual overview of APIs, scrapers, crawlers, RSS-feeds, databases, and different file formats Wednesday, 15–4 Writing some first data collection scripts Preparation • Conceptual level: Read the article by Morstatter, Pfeffer, Liu, and Carley (2013) about the limitations of the Twitter API. • Technical level: Make sure you are comfortable with the techniques we’ve covered so far. Play around. Give yourself some tasks and solve them. Google. Big Data and Automated Content Analysis Damian Trilling