SlideShare a Scribd company logo
1 of 15
Download to read offline
Python kao najbolji alat
za Data Scientist-a
http://datahacker.rs/blog-002-podaci-u-pythonu-biblioteka-
numpy/
datahacker.rs
Python vs. R
dataHacker : Python
Zašto Python?
▪ Python je popularniji od R-a
▪ Python je lider u Data Science-u i Machine Learning-u
▪ Pogledaj samo trend na donjoj slici
http://datahacker.rs/
datahacker.rs
Anaconda
Hajde da počnemo...
Preporučujemo da koristiš Anacondu, koju možeš preuzeti sa
sledećeg linka: https://www.anaconda.com/download/
Anaconda ima više od 6 miliona korisnika i sadrži 250 popularnih
Data Science paketa.
Zašto Anaconda?
Klikom na dugme
“Launch”, otvara
se Jupyter Notebook.
>> čita se “džupiter”
jupyter
datahacker.rs
Jupyter Notebook
Startovanje notebook-a
▪ Korak 1: klik na dugme “New”
▪ Korak 2: klik na “Python 3”
datahacker.rs
Python biblioteke za 

Data Science
1. NumPy (“Nam-paj”) Numerical Python - Visoko
optimizovan za rad sa numeričkim vektorima /
nizovima i matricama. http://www.numpy.org/
2. SciPy (“Sci-paj”) Science Python - Koristi NumPy
nizove i omogućava brza numerička izvršavanja
algoritama. https://www.scipy.org/scipylib/
3. Matplotlib – najpopularnija biblioteka za
vizualizaciju podataka, crtanje kvalitetnih grafikona
i dijagrama u Python-u. https://matplotlib.org/
datahacker.rs
Struktura podataka
datahacker.rs
Uvod u NumPy
Import biblioteke
Tab taster
Pritisnite Shift+Enter za izvršavanje ćelije.
datahacker.rs
Uvod u NumPy
Kreiranje niza
Savet: Obratiti pažnju na raspored zagrada.
Aritmetičke operacije
datahacker.rs
Uvod u NumPy
Atributi niza
Nakon generisanja niza, možemo proveriti njegove atribute.
▪ ndim - dimenzija niza
▪ shape - oblik niza
▪ size - veličina niza
Rezultat dimenzije niza je 1, kao što smo i očekivali obzirom da se radi o
vektoru. Oblik niza je 6 i veličina niza je 6.
datahacker.rs
Uvod u NumPy
Preoblikovanje niza
reshape() metoda pravi matricu od niza. Od prethodno kreiranog 1D niza (6, ), možemo kreirati
matricu, tj. 2D.
Sada već znamo kako se proveravaju atributi, tako da možemo proverti atribute
naše matrice.
datahacker.rs
Uvod u NumPy
Kreiranje niza sa nulama
Kreiranje matrice
Kreiranje niza sa jedinicama
datahacker.rs
Uvod u NumPy
Indeksiranje
Pojedinačnim elementima NumPy niza pristupamo indeksiranjem. Moguće je pristupiti
i delu niza (od elementa – do elementa). Na engleskom ova operacija se zove slicing.
datahacker.rs
Uvod u NumPy
Plotovanje
Za kraj uvodnog dela o nizovima možemo nacrtati jednu jednostavnu funkciju. Za tu funkciju
koristićemo standardnu biblioteku matplotlib.
1. U ovom primeru kreiraćemo vremensku osu, kao promenljivu t. Prvo ćemo je inicijalzirati
kao numpy niz od 0 do 999, a tip elementa je float.
2. Ukoliko podelimo svaki od ovih brojeva sa 1000, dobićemo fino uzorkovanu osu od 0 do 1.
3. Za ovu vremensku osu, kreiramo i kosinusnu funkciju. Uz pomoć element-
wise procesiranja, svaki element niza t, automatski će biti iskorišćen za generisanje
vrednosti nove funkcije (niza) x.
datahacker.rs
Vizualizacija
datahacker.rs
Vizuelizacija
U slučaju da Vam se grafik nije iscrtao, koristite:
import matplotlib.pyplot as plt
%matplotlib inline

More Related Content

Featured

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by HubspotMarius Sescu
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTExpeed Software
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsPixeldarts
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthThinkNow
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 

Featured (20)

2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot2024 State of Marketing Report – by Hubspot
2024 State of Marketing Report – by Hubspot
 
Everything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPTEverything You Need To Know About ChatGPT
Everything You Need To Know About ChatGPT
 
Product Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage EngineeringsProduct Design Trends in 2024 | Teenage Engineerings
Product Design Trends in 2024 | Teenage Engineerings
 
How Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental HealthHow Race, Age and Gender Shape Attitudes Towards Mental Health
How Race, Age and Gender Shape Attitudes Towards Mental Health
 
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 

Python kao najbolji alat za Data Scientist-a #002

  • 1. Python kao najbolji alat za Data Scientist-a http://datahacker.rs/blog-002-podaci-u-pythonu-biblioteka- numpy/
  • 2. datahacker.rs Python vs. R dataHacker : Python Zašto Python? ▪ Python je popularniji od R-a ▪ Python je lider u Data Science-u i Machine Learning-u ▪ Pogledaj samo trend na donjoj slici http://datahacker.rs/
  • 3. datahacker.rs Anaconda Hajde da počnemo... Preporučujemo da koristiš Anacondu, koju možeš preuzeti sa sledećeg linka: https://www.anaconda.com/download/ Anaconda ima više od 6 miliona korisnika i sadrži 250 popularnih Data Science paketa. Zašto Anaconda? Klikom na dugme “Launch”, otvara se Jupyter Notebook. >> čita se “džupiter” jupyter
  • 4. datahacker.rs Jupyter Notebook Startovanje notebook-a ▪ Korak 1: klik na dugme “New” ▪ Korak 2: klik na “Python 3”
  • 5. datahacker.rs Python biblioteke za 
 Data Science 1. NumPy (“Nam-paj”) Numerical Python - Visoko optimizovan za rad sa numeričkim vektorima / nizovima i matricama. http://www.numpy.org/ 2. SciPy (“Sci-paj”) Science Python - Koristi NumPy nizove i omogućava brza numerička izvršavanja algoritama. https://www.scipy.org/scipylib/ 3. Matplotlib – najpopularnija biblioteka za vizualizaciju podataka, crtanje kvalitetnih grafikona i dijagrama u Python-u. https://matplotlib.org/
  • 7. datahacker.rs Uvod u NumPy Import biblioteke Tab taster Pritisnite Shift+Enter za izvršavanje ćelije.
  • 8. datahacker.rs Uvod u NumPy Kreiranje niza Savet: Obratiti pažnju na raspored zagrada. Aritmetičke operacije
  • 9. datahacker.rs Uvod u NumPy Atributi niza Nakon generisanja niza, možemo proveriti njegove atribute. ▪ ndim - dimenzija niza ▪ shape - oblik niza ▪ size - veličina niza Rezultat dimenzije niza je 1, kao što smo i očekivali obzirom da se radi o vektoru. Oblik niza je 6 i veličina niza je 6.
  • 10. datahacker.rs Uvod u NumPy Preoblikovanje niza reshape() metoda pravi matricu od niza. Od prethodno kreiranog 1D niza (6, ), možemo kreirati matricu, tj. 2D. Sada već znamo kako se proveravaju atributi, tako da možemo proverti atribute naše matrice.
  • 11. datahacker.rs Uvod u NumPy Kreiranje niza sa nulama Kreiranje matrice Kreiranje niza sa jedinicama
  • 12. datahacker.rs Uvod u NumPy Indeksiranje Pojedinačnim elementima NumPy niza pristupamo indeksiranjem. Moguće je pristupiti i delu niza (od elementa – do elementa). Na engleskom ova operacija se zove slicing.
  • 13. datahacker.rs Uvod u NumPy Plotovanje Za kraj uvodnog dela o nizovima možemo nacrtati jednu jednostavnu funkciju. Za tu funkciju koristićemo standardnu biblioteku matplotlib. 1. U ovom primeru kreiraćemo vremensku osu, kao promenljivu t. Prvo ćemo je inicijalzirati kao numpy niz od 0 do 999, a tip elementa je float. 2. Ukoliko podelimo svaki od ovih brojeva sa 1000, dobićemo fino uzorkovanu osu od 0 do 1. 3. Za ovu vremensku osu, kreiramo i kosinusnu funkciju. Uz pomoć element- wise procesiranja, svaki element niza t, automatski će biti iskorišćen za generisanje vrednosti nove funkcije (niza) x.
  • 15. datahacker.rs Vizuelizacija U slučaju da Vam se grafik nije iscrtao, koristite: import matplotlib.pyplot as plt %matplotlib inline