SlideShare une entreprise Scribd logo
1  sur  30
Introduction to Data Science in Python
(Visualization ver.)
廻船孝行 (KAISEN Takayuki)
PyCon mini Hiroshima 2018
Contact: ksn0215@gmail.com
Ver. 3.1
Repository: https://github.com/ksnt/pycon_hiro_2018
Overview
1. Geographic Data Analysis
2. Interactive Graph and Application
3. Discussion
Python 3.6.3
Pip 10.0.1
Development Environment
Ubuntu 17.10
・ Injury due to an accident
Notice
・ Hard to pronounce some
words
・ Appreciate for
your cooperation in advance!
0. WHO ARE YOU?
⚫ Favorite Languages
⚪ Python, R, Scala
⚫ Interests
⚪SNA, CSS, CMC, ABM,
Complex Systems,
Data Science, ...
⚫ Python Conference Attendance
⚪PyCon mini JP (2010?)
⚪PyConJP 2011
⚪Tokyo.Scipy (2011?)
⚫ Love Online Learning
⚫ Oct 2017 - HiroshimaFreeman, L. (2004). The development of social network analysis. A Study in the
Sociology of Science, 1.
1. Social network analysis is motivated by a structural in-
tuition based on ties linking social actors,
2. It is grounded in systematic empirical data,
3. It draws heavily on graphic imagery, and
4. It relies on the use of mathematical and/or computation-
al models.
Takeaways: All I am Talking to You
1. It is incredibly easy to make use of
geographic data with Python
(Folium)
2. It is incredibly easy to develop data
driven web application with Python
(Plotly and Dash)
1. Geographic Data Analysis
2. Interactive Graph and Application
3. Discussion
How to use geographic data
GIS = Geographic Information System
“A geographic information system (GIS) is a system designed to capture,
store, manipulate, analyze, manage, and present spatial or geographic
data. “ Wikipedia
YOU DON’T HAVE TO USE GIS!
Reference: “Python Geospatial Development – Third Edition” Chapter2
How to make use of Geographic
data in Python
・ArcGIS, QGIS (PyQGIS)
・Geopandas
・Folium (Leaflet)
・Geopy
・And so forth…
(reference) https://qiita.com/aimof/items/b4e4551d27abaf5bb258
⚪ Do not need knowledge on GIS
⚪ Can easily create Web map
How to install folium
$ pip install folium
$ conda install -c conda-forge folium
or
Data & Visualization(1)
https://nbviewer.jupyter.org/github/ksnt/Predictor-of-blights-in-
Detroit/blob/master/Final_Report_1.1.ipynb
HERE!
Data & Visualization(2)
df = pd.Dataframe()
df = df.attend(crime_data[‘LAT’])
df = df.attend(crime_data[‘LON’])
df = df.T
df = df.reset_index(drop=True)
df[‘LAT’] = round(df[‘LAT’],3)
df[‘LON’] = round(df[‘LON’],3)
df.head()
Data & Visualization(3)
from folium.plugins import HeatMap
from IPython.display import HTML
import folium
map_detroit = folium.Map(location=(42.40,-83.01))
data = []
for i in range(len(df)):
data.append((df['LAT'][i],df['LON'][i]))
HeatMap(data,radius=9).add_to(map_detroit)
map_detroit.save('crimes.html')
HTML(r'<iframe width="800" height="500"
frameborder="0" allowfullscreen
src="./crimes.html"></iframe>')
https://nbviewer.jupyter.org/github/ksnt/Predictor-of-blights-in-
Detroit/blob/master/Final_Report_1.1.ipynb
Data & Visualization(4)
How to visualize geographical data with folium
1. Data cleaning
2. Create map
3. Put the data into the map!
(4. Save the map as a HTML file )
(5. Draw the HTML file )
HeatMap(data,radius=9).add_to(map_detroit)
1. Geographic Data Analysis
2. Interactive Graph and Application
3. Discussion
Data Visualization in Python
⚫ seaborn: cool
⚫ bokeh: cool, interactive
⚫ plotly: cool, interactive, reactive
⚫ matplotlib: standard
⚫ PixieDust (IBM?): interactive, …?
>>> plotly.__version__
'2.4.1'
>>> dash.__version__
'0.21.0'
⚫ mpld3: cool, interactive
How to Use Plotly and Dash
$ pip install plotly
$ pip install dash
$ python
>>> import plotly
>>> import dash
Interactive Graph For Scatter Plot
(Optional)
https://nbviewer.jupyter.org/gist/ksnt/340910aae39670202e4f790213e7afdc
Interactive Graph for Bar Plot
import pandas as pd
import plotly
import plotly.graph_objs as go
df2 = pd.read_excel('globalterrorismdb_0616dist.xlsx',header=0)
data = [go.Bar(
x=df2["country_txt"].value_counts()[:20].index,
y=df2["country_txt"].value_counts()[:20]
)]
layout = go.Layout(
title="Top 20 Frequency of Terrorism Incidents 1970 - 2015",
xaxis={"title":"Country"},
yaxis={"title":"Occurence of terrorism"},
)
fig = go.Figure(data=data, layout=layout) # Preparation of plot by Plotly
plotly.offline.iplot(fig, filename='basic-bar') # not online figure
You have to prepare for this data!
https://nbviewer.jupyter.org/gist/ksnt/eb8ac99dd69ecc5dc5774bf673977ceb
Interactive Graph for Time Series Plot
layout = plotly.graph_objs.Layout(
title="Occurence of Terrorism Incidents",
xaxis={"title":"Year"},
yaxis={"title":"Occurence of terrorism"},
)
iraq_incidents = df2[df2["country_txt"] == "Iraq"]
iraq_incidents_count = iraq_incidents['iyear'].value_counts()
iraq_incidents_count = iraq_incidents_count.sort_index()
iraq = go.Scatter(
x=iraq_incidents_count.index,
y=iraq_incidents_count,
name = "Iraq",
line = dict(color="black"),
Opacity = 0.8)
year = [i for i in range(1970,2016)]
data = [iraq,us,pakistan,india,afghanistan,colombia,peru,phil,el,uk,turkey,spain,sri,somalia,nigeria,algeria,
france,yemen,lebanon]
fig = plotly.graph_objs.Figure(data=data, layout=layout)
plotly.offline.iplot(fig, show_link=False,config={"displaylogo":False, "modeBarButtonsToRemove":
["sendDataToCloud"]})
https://nbviewer.jupyter.org/gist/ksnt/eb8ac99dd69ecc5dc5774bf673977ceb
Additional Example – MonteCarlo
Simulation (Optional)
https://nbviewer.jupyter.org/gist/ksnt/101a44cc21b0eb990f96dc1d640dbd42
Plotly Dash
“”” Dash is Shiny for Python “””
― Chris Parmer, Dash: Shiny for Python
https://youtu.be/5BAthiN0htc
“ Dash is a Python framework for building web application”
・ Flask
・ React.js
・ Ideal for building data visualization apps
Monte Carlo Simulator (1)
https://montecarlo-dash-app.herokuapp.com/
Monte Carlo Simulator (2)
Krauth, W. (2006). Statistical mechanics: algorithms and computations (Vol. 13). OUP Oxford.
Covered by points
Num of all points →S(□) = 4
r=1 r=1
Num of point in the circle
→ S(○) = π
Num of all points
Num of point in the circle
S(○)
S(□)
=
4
π
Count up these points!
Points = {x,y}, x,y 〜 U(-1,1)
Useful article about Monte Carlo Simulation in Japanese is:
—モンテカルロ法の前線 サイコロを振って積分する方法 福島 孝治
https://www.smapip.is.tohoku.ac.jp/~smapip/2003/tutorial/presentation/koji-hukushima.pdf
Institution
Monte Carlo Simulator (3)
https://montecarlo-dash-app.herokuapp.com/
Monte Carlo Simulator (4)
https://gist.github.com/ksnt/ccd88b6f63081e6d2d11f0daf6d0bc4e
⚫ Import libraries
⚫ app = dash.Dash()
server=app.server
server.secret_key = os.environ.get('secret_key', 'secret')
⚫ app.layout = html.Div( # WRITE LAYOUT)
⚫ @app.callback( #WRITE OPERATION)
⚫ if __name__ == '__main__':
app.run_server(debug=True)
View
Controller
Python vs R
as Data Visualization Tool
Speed Extensibility Price Packages/ Libraries
(for Data Analysis)
Python ○ ◎ Free ML
R △ △
OOP
(S3,S4,R5(>=2.12))
Free Statistics
Tableau ? △?
For EDA?
¥18000/year
¥51000/year
¥102000/year
¥0/year students
and teachers
?
Kibana, Superset, Redash, Metabase, Splunk, KNIME, Google Charts, etc…
Julia, Matlab, Scilab, Octave, etc...
3 – 2ε. Welcome to Plotly Dash
Document Translation Project!
https://goo.gl/wnjHA6 HERE!
3 – ε. I am looking for new
opportunities!
・ Places: Anywhere
・ Salary & Benefits: Negotiable
・ Feel free to talk to me!
・ Like: International, Diverse, Python,
Data analysis
1. Geographic Data Analysis
2. Interactive Graph and Application
3. Discussion
Discussion

Contenu connexe

Similaire à Pyconmini Hiroshima 2018

Geospatial Data Analysis and Visualization in Python
Geospatial Data Analysis and Visualization in PythonGeospatial Data Analysis and Visualization in Python
Geospatial Data Analysis and Visualization in PythonHalfdan Rump
 
Python Pyplot Class XII
Python Pyplot Class XIIPython Pyplot Class XII
Python Pyplot Class XIIajay_opjs
 
Python tools to deploy your machine learning models faster
Python tools to deploy your machine learning models fasterPython tools to deploy your machine learning models faster
Python tools to deploy your machine learning models fasterJeff Hale
 
Using the Kinect for Fun and Profit by Tam Hanna
Using the Kinect for Fun and Profit by Tam HannaUsing the Kinect for Fun and Profit by Tam Hanna
Using the Kinect for Fun and Profit by Tam HannaCodemotion
 
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰Jung Kim
 
An Introduction to Game Programming with Flash: An Introduction to Flash and ...
An Introduction to Game Programming with Flash: An Introduction to Flash and ...An Introduction to Game Programming with Flash: An Introduction to Flash and ...
An Introduction to Game Programming with Flash: An Introduction to Flash and ...Krzysztof Opałka
 
Atari Game State Representation using Convolutional Neural Networks
Atari Game State Representation using Convolutional Neural NetworksAtari Game State Representation using Convolutional Neural Networks
Atari Game State Representation using Convolutional Neural Networksjohnstamford
 
carrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-APIcarrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-APIYoni Davidson
 
Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...
Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...
Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...Jason Dai
 
Deep Learning as a Cat/Dog Detector
Deep Learning as a Cat/Dog DetectorDeep Learning as a Cat/Dog Detector
Deep Learning as a Cat/Dog DetectorRoelof Pieters
 
(120303) #fitalk ip finder and geo ip for fun
(120303) #fitalk   ip finder and geo ip for fun(120303) #fitalk   ip finder and geo ip for fun
(120303) #fitalk ip finder and geo ip for funINSIGHT FORENSIC
 
(120303) #fitalk ip finder and geo ip for fun
(120303) #fitalk   ip finder and geo ip for fun(120303) #fitalk   ip finder and geo ip for fun
(120303) #fitalk ip finder and geo ip for funINSIGHT FORENSIC
 
Synthetic Data and Graphics Techniques in Robotics
Synthetic Data and Graphics Techniques in RoboticsSynthetic Data and Graphics Techniques in Robotics
Synthetic Data and Graphics Techniques in RoboticsPrabindh Sundareson
 
#OSSPARIS19 - Computer Vision framework for GeoSpatial Imagery: RoboSat.pink ...
#OSSPARIS19 - Computer Vision framework for GeoSpatial Imagery: RoboSat.pink ...#OSSPARIS19 - Computer Vision framework for GeoSpatial Imagery: RoboSat.pink ...
#OSSPARIS19 - Computer Vision framework for GeoSpatial Imagery: RoboSat.pink ...Paris Open Source Summit
 
Designing Interactive Web Based AR Experiences
Designing Interactive Web Based AR ExperiencesDesigning Interactive Web Based AR Experiences
Designing Interactive Web Based AR ExperiencesFITC
 
David Mertz. Type Annotations. PyCon Belarus 2015
David Mertz. Type Annotations. PyCon Belarus 2015David Mertz. Type Annotations. PyCon Belarus 2015
David Mertz. Type Annotations. PyCon Belarus 2015Alina Dolgikh
 
Three Functional Programming Technologies for Big Data
Three Functional Programming Technologies for Big DataThree Functional Programming Technologies for Big Data
Three Functional Programming Technologies for Big DataDynamical Software, Inc.
 
닷넷 개발자를 위한 패턴이야기
닷넷 개발자를 위한 패턴이야기닷넷 개발자를 위한 패턴이야기
닷넷 개발자를 위한 패턴이야기YoungSu Son
 
Exploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptExploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptwesley chun
 

Similaire à Pyconmini Hiroshima 2018 (20)

Geospatial Data Analysis and Visualization in Python
Geospatial Data Analysis and Visualization in PythonGeospatial Data Analysis and Visualization in Python
Geospatial Data Analysis and Visualization in Python
 
Binary Analysis - Luxembourg
Binary Analysis - LuxembourgBinary Analysis - Luxembourg
Binary Analysis - Luxembourg
 
Python Pyplot Class XII
Python Pyplot Class XIIPython Pyplot Class XII
Python Pyplot Class XII
 
Python tools to deploy your machine learning models faster
Python tools to deploy your machine learning models fasterPython tools to deploy your machine learning models faster
Python tools to deploy your machine learning models faster
 
Using the Kinect for Fun and Profit by Tam Hanna
Using the Kinect for Fun and Profit by Tam HannaUsing the Kinect for Fun and Profit by Tam Hanna
Using the Kinect for Fun and Profit by Tam Hanna
 
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
Letswift18 워크숍#1 스위프트 클린코드와 코드리뷰
 
An Introduction to Game Programming with Flash: An Introduction to Flash and ...
An Introduction to Game Programming with Flash: An Introduction to Flash and ...An Introduction to Game Programming with Flash: An Introduction to Flash and ...
An Introduction to Game Programming with Flash: An Introduction to Flash and ...
 
Atari Game State Representation using Convolutional Neural Networks
Atari Game State Representation using Convolutional Neural NetworksAtari Game State Representation using Convolutional Neural Networks
Atari Game State Representation using Convolutional Neural Networks
 
carrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-APIcarrow - Go bindings to Apache Arrow via C++-API
carrow - Go bindings to Apache Arrow via C++-API
 
Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...
Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...
Automated ML Workflow for Distributed Big Data Using Analytics Zoo (CVPR2020 ...
 
Deep Learning as a Cat/Dog Detector
Deep Learning as a Cat/Dog DetectorDeep Learning as a Cat/Dog Detector
Deep Learning as a Cat/Dog Detector
 
(120303) #fitalk ip finder and geo ip for fun
(120303) #fitalk   ip finder and geo ip for fun(120303) #fitalk   ip finder and geo ip for fun
(120303) #fitalk ip finder and geo ip for fun
 
(120303) #fitalk ip finder and geo ip for fun
(120303) #fitalk   ip finder and geo ip for fun(120303) #fitalk   ip finder and geo ip for fun
(120303) #fitalk ip finder and geo ip for fun
 
Synthetic Data and Graphics Techniques in Robotics
Synthetic Data and Graphics Techniques in RoboticsSynthetic Data and Graphics Techniques in Robotics
Synthetic Data and Graphics Techniques in Robotics
 
#OSSPARIS19 - Computer Vision framework for GeoSpatial Imagery: RoboSat.pink ...
#OSSPARIS19 - Computer Vision framework for GeoSpatial Imagery: RoboSat.pink ...#OSSPARIS19 - Computer Vision framework for GeoSpatial Imagery: RoboSat.pink ...
#OSSPARIS19 - Computer Vision framework for GeoSpatial Imagery: RoboSat.pink ...
 
Designing Interactive Web Based AR Experiences
Designing Interactive Web Based AR ExperiencesDesigning Interactive Web Based AR Experiences
Designing Interactive Web Based AR Experiences
 
David Mertz. Type Annotations. PyCon Belarus 2015
David Mertz. Type Annotations. PyCon Belarus 2015David Mertz. Type Annotations. PyCon Belarus 2015
David Mertz. Type Annotations. PyCon Belarus 2015
 
Three Functional Programming Technologies for Big Data
Three Functional Programming Technologies for Big DataThree Functional Programming Technologies for Big Data
Three Functional Programming Technologies for Big Data
 
닷넷 개발자를 위한 패턴이야기
닷넷 개발자를 위한 패턴이야기닷넷 개발자를 위한 패턴이야기
닷넷 개발자를 위한 패턴이야기
 
Exploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScriptExploring Google (Cloud) APIs with Python & JavaScript
Exploring Google (Cloud) APIs with Python & JavaScript
 

Dernier

Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAroojKhan71
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxolyaivanovalion
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Callshivangimorya083
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxolyaivanovalion
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubaihf8803863
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingNeil Barnes
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsappssapnasaifi408
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一ffjhghh
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxolyaivanovalion
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130Suhani Kapoor
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Callshivangimorya083
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptxthyngster
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfSocial Samosa
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiSuhani Kapoor
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxJohnnyPlasten
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptxAnupama Kate
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxolyaivanovalion
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSAishani27
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFxolyaivanovalion
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxfirstjob4
 

Dernier (20)

Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al BarshaAl Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
Al Barsha Escorts $#$ O565212860 $#$ Escort Service In Al Barsha
 
VidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptxVidaXL dropshipping via API with DroFx.pptx
VidaXL dropshipping via API with DroFx.pptx
 
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
꧁❤ Greater Noida Call Girls Delhi ❤꧂ 9711199171 ☎️ Hard And Sexy Vip Call
 
BabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptxBabyOno dropshipping via API with DroFx.pptx
BabyOno dropshipping via API with DroFx.pptx
 
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls DubaiDubai Call Girls Wifey O52&786472 Call Girls Dubai
Dubai Call Girls Wifey O52&786472 Call Girls Dubai
 
Brighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data StorytellingBrighton SEO | April 2024 | Data Storytelling
Brighton SEO | April 2024 | Data Storytelling
 
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /WhatsappsBeautiful Sapna Vip  Call Girls Hauz Khas 9711199012 Call /Whatsapps
Beautiful Sapna Vip Call Girls Hauz Khas 9711199012 Call /Whatsapps
 
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一定制英国白金汉大学毕业证(UCB毕业证书)																			成绩单原版一比一
定制英国白金汉大学毕业证(UCB毕业证书) 成绩单原版一比一
 
Smarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptxSmarteg dropshipping via API with DroFx.pptx
Smarteg dropshipping via API with DroFx.pptx
 
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
VIP Call Girls Service Miyapur Hyderabad Call +91-8250192130
 
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip CallDelhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
Delhi Call Girls Punjabi Bagh 9711199171 ☎✔👌✔ Whatsapp Hard And Sexy Vip Call
 
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptxEMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM  TRACKING WITH GOOGLE ANALYTICS.pptx
EMERCE - 2024 - AMSTERDAM - CROSS-PLATFORM TRACKING WITH GOOGLE ANALYTICS.pptx
 
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdfKantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
Kantar AI Summit- Under Embargo till Wednesday, 24th April 2024, 4 PM, IST.pdf
 
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service BhilaiLow Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
Low Rate Call Girls Bhilai Anika 8250192130 Independent Escort Service Bhilai
 
Log Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptxLog Analysis using OSSEC sasoasasasas.pptx
Log Analysis using OSSEC sasoasasasas.pptx
 
100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx100-Concepts-of-AI by Anupama Kate .pptx
100-Concepts-of-AI by Anupama Kate .pptx
 
BigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptxBigBuy dropshipping via API with DroFx.pptx
BigBuy dropshipping via API with DroFx.pptx
 
Ukraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICSUkraine War presentation: KNOW THE BASICS
Ukraine War presentation: KNOW THE BASICS
 
Halmar dropshipping via API with DroFx
Halmar  dropshipping  via API with DroFxHalmar  dropshipping  via API with DroFx
Halmar dropshipping via API with DroFx
 
Introduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptxIntroduction-to-Machine-Learning (1).pptx
Introduction-to-Machine-Learning (1).pptx
 

Pyconmini Hiroshima 2018

  • 1. Introduction to Data Science in Python (Visualization ver.) 廻船孝行 (KAISEN Takayuki) PyCon mini Hiroshima 2018 Contact: ksn0215@gmail.com Ver. 3.1 Repository: https://github.com/ksnt/pycon_hiro_2018
  • 2. Overview 1. Geographic Data Analysis 2. Interactive Graph and Application 3. Discussion Python 3.6.3 Pip 10.0.1 Development Environment Ubuntu 17.10
  • 3. ・ Injury due to an accident Notice ・ Hard to pronounce some words ・ Appreciate for your cooperation in advance!
  • 4. 0. WHO ARE YOU? ⚫ Favorite Languages ⚪ Python, R, Scala ⚫ Interests ⚪SNA, CSS, CMC, ABM, Complex Systems, Data Science, ... ⚫ Python Conference Attendance ⚪PyCon mini JP (2010?) ⚪PyConJP 2011 ⚪Tokyo.Scipy (2011?) ⚫ Love Online Learning ⚫ Oct 2017 - HiroshimaFreeman, L. (2004). The development of social network analysis. A Study in the Sociology of Science, 1. 1. Social network analysis is motivated by a structural in- tuition based on ties linking social actors, 2. It is grounded in systematic empirical data, 3. It draws heavily on graphic imagery, and 4. It relies on the use of mathematical and/or computation- al models.
  • 5. Takeaways: All I am Talking to You 1. It is incredibly easy to make use of geographic data with Python (Folium) 2. It is incredibly easy to develop data driven web application with Python (Plotly and Dash)
  • 6. 1. Geographic Data Analysis 2. Interactive Graph and Application 3. Discussion
  • 7. How to use geographic data GIS = Geographic Information System “A geographic information system (GIS) is a system designed to capture, store, manipulate, analyze, manage, and present spatial or geographic data. “ Wikipedia YOU DON’T HAVE TO USE GIS! Reference: “Python Geospatial Development – Third Edition” Chapter2
  • 8. How to make use of Geographic data in Python ・ArcGIS, QGIS (PyQGIS) ・Geopandas ・Folium (Leaflet) ・Geopy ・And so forth… (reference) https://qiita.com/aimof/items/b4e4551d27abaf5bb258 ⚪ Do not need knowledge on GIS ⚪ Can easily create Web map
  • 9. How to install folium $ pip install folium $ conda install -c conda-forge folium or
  • 11. Data & Visualization(2) df = pd.Dataframe() df = df.attend(crime_data[‘LAT’]) df = df.attend(crime_data[‘LON’]) df = df.T df = df.reset_index(drop=True) df[‘LAT’] = round(df[‘LAT’],3) df[‘LON’] = round(df[‘LON’],3) df.head()
  • 12. Data & Visualization(3) from folium.plugins import HeatMap from IPython.display import HTML import folium map_detroit = folium.Map(location=(42.40,-83.01)) data = [] for i in range(len(df)): data.append((df['LAT'][i],df['LON'][i])) HeatMap(data,radius=9).add_to(map_detroit) map_detroit.save('crimes.html') HTML(r'<iframe width="800" height="500" frameborder="0" allowfullscreen src="./crimes.html"></iframe>') https://nbviewer.jupyter.org/github/ksnt/Predictor-of-blights-in- Detroit/blob/master/Final_Report_1.1.ipynb
  • 13. Data & Visualization(4) How to visualize geographical data with folium 1. Data cleaning 2. Create map 3. Put the data into the map! (4. Save the map as a HTML file ) (5. Draw the HTML file ) HeatMap(data,radius=9).add_to(map_detroit)
  • 14. 1. Geographic Data Analysis 2. Interactive Graph and Application 3. Discussion
  • 15. Data Visualization in Python ⚫ seaborn: cool ⚫ bokeh: cool, interactive ⚫ plotly: cool, interactive, reactive ⚫ matplotlib: standard ⚫ PixieDust (IBM?): interactive, …? >>> plotly.__version__ '2.4.1' >>> dash.__version__ '0.21.0' ⚫ mpld3: cool, interactive
  • 16. How to Use Plotly and Dash $ pip install plotly $ pip install dash $ python >>> import plotly >>> import dash
  • 17. Interactive Graph For Scatter Plot (Optional) https://nbviewer.jupyter.org/gist/ksnt/340910aae39670202e4f790213e7afdc
  • 18. Interactive Graph for Bar Plot import pandas as pd import plotly import plotly.graph_objs as go df2 = pd.read_excel('globalterrorismdb_0616dist.xlsx',header=0) data = [go.Bar( x=df2["country_txt"].value_counts()[:20].index, y=df2["country_txt"].value_counts()[:20] )] layout = go.Layout( title="Top 20 Frequency of Terrorism Incidents 1970 - 2015", xaxis={"title":"Country"}, yaxis={"title":"Occurence of terrorism"}, ) fig = go.Figure(data=data, layout=layout) # Preparation of plot by Plotly plotly.offline.iplot(fig, filename='basic-bar') # not online figure You have to prepare for this data! https://nbviewer.jupyter.org/gist/ksnt/eb8ac99dd69ecc5dc5774bf673977ceb
  • 19. Interactive Graph for Time Series Plot layout = plotly.graph_objs.Layout( title="Occurence of Terrorism Incidents", xaxis={"title":"Year"}, yaxis={"title":"Occurence of terrorism"}, ) iraq_incidents = df2[df2["country_txt"] == "Iraq"] iraq_incidents_count = iraq_incidents['iyear'].value_counts() iraq_incidents_count = iraq_incidents_count.sort_index() iraq = go.Scatter( x=iraq_incidents_count.index, y=iraq_incidents_count, name = "Iraq", line = dict(color="black"), Opacity = 0.8) year = [i for i in range(1970,2016)] data = [iraq,us,pakistan,india,afghanistan,colombia,peru,phil,el,uk,turkey,spain,sri,somalia,nigeria,algeria, france,yemen,lebanon] fig = plotly.graph_objs.Figure(data=data, layout=layout) plotly.offline.iplot(fig, show_link=False,config={"displaylogo":False, "modeBarButtonsToRemove": ["sendDataToCloud"]}) https://nbviewer.jupyter.org/gist/ksnt/eb8ac99dd69ecc5dc5774bf673977ceb
  • 20. Additional Example – MonteCarlo Simulation (Optional) https://nbviewer.jupyter.org/gist/ksnt/101a44cc21b0eb990f96dc1d640dbd42
  • 21. Plotly Dash “”” Dash is Shiny for Python “”” ― Chris Parmer, Dash: Shiny for Python https://youtu.be/5BAthiN0htc “ Dash is a Python framework for building web application” ・ Flask ・ React.js ・ Ideal for building data visualization apps
  • 22. Monte Carlo Simulator (1) https://montecarlo-dash-app.herokuapp.com/
  • 23. Monte Carlo Simulator (2) Krauth, W. (2006). Statistical mechanics: algorithms and computations (Vol. 13). OUP Oxford. Covered by points Num of all points →S(□) = 4 r=1 r=1 Num of point in the circle → S(○) = π Num of all points Num of point in the circle S(○) S(□) = 4 π Count up these points! Points = {x,y}, x,y 〜 U(-1,1) Useful article about Monte Carlo Simulation in Japanese is: —モンテカルロ法の前線 サイコロを振って積分する方法 福島 孝治 https://www.smapip.is.tohoku.ac.jp/~smapip/2003/tutorial/presentation/koji-hukushima.pdf Institution
  • 24. Monte Carlo Simulator (3) https://montecarlo-dash-app.herokuapp.com/
  • 25. Monte Carlo Simulator (4) https://gist.github.com/ksnt/ccd88b6f63081e6d2d11f0daf6d0bc4e ⚫ Import libraries ⚫ app = dash.Dash() server=app.server server.secret_key = os.environ.get('secret_key', 'secret') ⚫ app.layout = html.Div( # WRITE LAYOUT) ⚫ @app.callback( #WRITE OPERATION) ⚫ if __name__ == '__main__': app.run_server(debug=True) View Controller
  • 26. Python vs R as Data Visualization Tool Speed Extensibility Price Packages/ Libraries (for Data Analysis) Python ○ ◎ Free ML R △ △ OOP (S3,S4,R5(>=2.12)) Free Statistics Tableau ? △? For EDA? ¥18000/year ¥51000/year ¥102000/year ¥0/year students and teachers ? Kibana, Superset, Redash, Metabase, Splunk, KNIME, Google Charts, etc… Julia, Matlab, Scilab, Octave, etc...
  • 27. 3 – 2ε. Welcome to Plotly Dash Document Translation Project! https://goo.gl/wnjHA6 HERE!
  • 28. 3 – ε. I am looking for new opportunities! ・ Places: Anywhere ・ Salary & Benefits: Negotiable ・ Feel free to talk to me! ・ Like: International, Diverse, Python, Data analysis
  • 29. 1. Geographic Data Analysis 2. Interactive Graph and Application 3. Discussion

Notes de l'éditeur

  1. 1.RはOOPで書きづらい ※ただし私が知っているのはS3クラスというものを使うやりかたで、S4やR5といった別のものを使えばそこまで書きづらくもないのかもしれない  参考: https://sites.google.com/site/scriptofbioinformatics/r-tong-ji-guan-xi/rnoobujekuto-zhi-xiangnitsuite-r 2. Rでオレオレグラフを作るのがしんどかった経験 ggplot2を拡張するコードを書いたことがあるがしんどすぎてメゲそうになった。実際に作者であるWickham自身もggplot2の作りについて反省している。 参考:http://yutannihilation.github.io/ggplot2-vignette-ja/extending-ggplot2.html  ただ、一方で例えばPythonmatplotlibを拡張しようとしたときに簡単にできるのかという疑問はある。