Indexing and selecting data# The axis labeling information in pandas objects serves many purposes: Identifies data (i.e. provides metadata) using known indicators, important for analysis, visualization, and interactive console display. Enables automatic and explicit data alignment. Allows intuitive getting and setting of subsets of the data set. In this section, we will focus on the final point: n
åæ© Dockerä¸ã§Jupyter Notebookã使ãããã£ãã®ã§ãã¼ã¯ã³ã¨ãã¹ã¯ã¼ãèªè¨¼ãã¹ããããããã£ãã å ¬å¼ã§ NOT RECOMMENDED ã¨ããã¦ãããMacã®å ´åFirewallãç¡å¹ã«ãã¦ããå ´åã«ã¯ãããã¯ã¼ã¯çµç±ã§ä¸æ£ã«ã¢ã¯ã»ã¹ãããå±éºæ§ãé«ãã®ã§èªå·±è²¬ä»»ã§ã ç°å¢ macOS 10.14.1 Mojave Jupyter Notebook Data Science Stack 6.0.0.dev https://hub.docker.com/r/jupyter/datascience-notebook/ ããæ¹ Security in the Jupyter notebook server â Jupyter Notebook 7.0.0.dev0 documentation ã®éãã jupyter_notebook_config.py ãç·¨éããã*1
WEBä¸ã§Pythonã®ã³ã¼ããæ¸ãã¦åºåçµæããªã¢ã«ã¿ã¤ã ã§è¦ãã¦ãããã«ãã®å±¥æ´ãæ®ããå ¬éãããã¨ãã§ãã便å©ãªJupitor Notebook æ¯å jupyter notebook ã§èµ·åãã¦Tokenå«ãã URLããã¢ã¯ã»ã¹ãããã®ã®ã次å以éã¯ãããªURLè¦ãã¦ããããããããªãã Token authentication is enabled If no password has been configured, you need to open the notebook server with its login token in the URL, or paste it above. This requirement will be lifted if you enable a password. ã£ã¦æããããä»æ¹ãªãããJupyter notebookããªã¹ã¿ã¼ãã
ãªããPython3.6ããæååã¡ã½ããstr.format()ãããç°¡æ½ã«è¨è¿°ã§ããfæååï¼f-stringsï¼ã追å ãããã以ä¸ã®è¨äºãåç §ã é¢é£è¨äº: Pythonã®fæååï¼ãã©ã¼ãããæ¸ã¿æååãªãã©ã«ï¼ã®ä½¿ãæ¹ çµã¿è¾¼ã¿é¢æ° format() çµã¿è¾¼ã¿é¢æ°ã¨ãã¦format()ãæä¾ããã¦ããã çµã¿è¾¼ã¿é¢æ° - format() â Python 3.11.3 ããã¥ã¡ã³ã 第ä¸å¼æ°ã«å ã®æååstrãæ°å¤int, floatãªã©ã第äºå¼æ°ã«æ¸å¼æå®æååãæå®ããã¨ãæ¸å¼åãããæååstrãè¿ãããã ä¾ã示ããæ¸å¼æå®æååã®æ¸ãæ¹ã«ã¤ãã¦ã¯å¾è¿°ã i = 255 print(format(i, '#04x')) print(type(format(i, '#04x'))) # 0xff # <class 'str'> s = 'abc' print(format
#ç®ç æ¬ç¨¿ã®ç®çã¯, Python ãç¨ã㦠Arduino ã¨ã·ãªã¢ã«éä¿¡ãè¡ã, æ´ã«åéä¿¡ã«ããå¾ãå¤ãæ°å¤ã¨ãã¦å¦çã§ããããã«ãããã¨ã§ãã. ç®æ¨ PCå´ãã Arduino ã«ãã¼ã¿ãéä¿¡, ãã®å 容ã«å¿ã㦠Arduino ã®åä½ãå¤åããã PCã, Arduino ããåä¿¡ãããã¼ã¿ãæ°å¤çã«å¦çã§ããããã«ãã å ·ä½çç®æ¨ PCããæåãã¼ã¿ãéä¿¡ã, Arduinoã®LEDã®ææ» ãæä½ããããã°ã©ã ãçµã è¶ é³æ³¢è·é¢ã»ã³ãµ HC-SR04 ããå¾ããã¼ã¿ããæ°å¤ãåãåºãããã°ã©ã ãçµã ä¸è¨ããã°ã©ã è¨èªã«ã¯ Python 3.x ãå©ç¨ãã æºå Arduino Uno Rev.3 USBã±ã¼ãã« LED ã¸ã£ã³ãã¯ã¤ã¤ 4æ¬ HC-SR04 Python 3.x , Arduino IDE Python ã¢ã¸ã¥ã¼ã« : PySerial ç°å¢ Windows
docker build -t python-test:latest . Sending build context to Docker daemon 3.072kB Step 1/4 : FROM alpine:3.7 ---> 70cb411a7a13 Step 2/4 : RUN apk --update-cache add musl linux-headers gcc g++ make gfortran openblas-dev python3 python3-dev ---> Running in f429cc126e22 fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/main/x86_64/APKINDEX.tar.gz fetch http://dl-cdn.alpinelinux.org/alpine/v3.7/commun
JavaScript Figure Reference: Single-Page How are Plotly attributes organized? plotly.js charts are described declaratively as JSON objects. Every aspect of a plotly chart (the colors, the grids, the data, and so on) has a corresponding JSON attribute. This page contains an extensive list of these attributes. Plotly's graph description places attributes into two categories: traces (objects that des
Interactive Visualizations This is the 3rd chapter of the Dash Fundamentals. The previous chapter covered basic callback usage. The next chapter describes how to share data between callbacks. Just getting started? Make sure to install the necessary dependencies. The Dash Core Components (dash.dcc) module includes a Graph component called dcc.Graph. dcc.Graph renders interactive data visualizations
ä¸æ¹ãä»åç´¹ä»ããPlotlyã«é¢ãã¦ã¯ããã¡ããJupyter notebookä¸ã§ããã¦ã¹ã§åããããã§ããã°ã©ããçæãããã¨ãã§ãã¾ãã ã©ã¡ããPythonããå®è¡ã§ãã¾ãããä»ã«ãRãJuliaãªã©ã®ä»è¨èªãããå®è¡å¯è½ã®ããã§ãã éã«ç°ãªãç¹ã¨ãã¦ã¯ãPlotlyã«ã¯3Dããããã®ã°ã©ããããã¾ãããBokehã«ã¯3Dãããããããã¾ããã ã¾ãã詳ããã¯å¾è¿°ãã¾ãããPlotlyã«ã¯ãªã³ã©ã¤ã³ã¨ãªãã©ã¤ã³ãç¡åçã¨æåçã®ä½¿ãåããããã¾ãã ã¾ããä»åã¯ç´¹ä»ãã¾ãããããã®Plotlyã®ã°ã©ãçææ©è½ããã¼ã¹ã¨ããWebã¢ããªã±ã¼ã·ã§ã³ãã¬ã¼ã ã¯ã¼ã¯ã¨ãã¦ãDashãã¨ãããã®ãããã¿ããã§ãã Dash: https://plot.ly/products/dash/ Plotlyã¯ãã¤ã³ã¿ã©ã¯ãã£ããªã°ã©ããä½æã§ãããªã¼ãã³ã½ã¼ã¹ã®ã©ã¤ãã©ãªã§ãã PythonãR
éçºç°å¢ãä½ã£ã¦ãã®æ¥½ãã人種ãªã®ã§å®æçã«éçºç°å¢ãè¦ç´ããããªãã¾ãã Dockerã使ã£ã¦ãã¼ã¿ãã«ãªéçºç°å¢ãæã«å ¥ããã®ã§ç´¹ä»ãã¾ãã éçºç¨ã³ã³ããã¨å種ãã¼ã¿ãã¼ã¹ã³ã³ãããdocker-composeã使ã£ã¦æ§ç¯ãã¾ãã âTOC Dockerãã¼ã¿ãã«ãªéçºç°å¢ éçºç¨ã³ã³ãã ãã¼ã¹ åè¨èª Ruby (rbenv) Python (pyenv) Golang (1.5) Node.js (nvm) ãã¼ã¿ãã¼ã¹ ãã¼ã¿ãã¼ã¹ã³ã³ãã ä»é² Dockerfile docker-compose.yml Dockerãã¼ã¿ãã«ãªéçºç°å¢ "docker-compose up -d"ã§éçºç°å¢ãåºæ¥ä¸ããã¾ããããããmysqlãredisä»ã使ããããããã ãã£ã¬ã¯ããªæ§æã¯ä»¥ä¸ã®ããã«ãªã£ã¦ãã¾ãã |-- data | |-- mongo | |-- mysql |
åé¡ç¹ 以ä¸ã®ãããªã³ãã³ãã§ãã°ã©ãã®ã¿ã¤ãã«ã«ãæ¥æ¬èªãã表示ããããã¨ãã¾ããããæ¥æ¬èªé¨åããâ¡â¡â¡ãã¨æååããã¦ãã¾ã£ã¦ãã¾ãã %matplotlib inline from matplotlib import pyplot as plt plt.style.use('ggplot') plt.figure(figsize=(12,5)) plt.plot(0,0) plt.title("æ¥æ¬èª") matplotlibã§ä½¿ç¨å¯è½ãªãã©ã³ãä¸è¦§ã調ã¹ã 以ä¸ã®ã³ãã³ãã§èªã¿è¾¼ã¾ãã¦ãããmatplotlibã§ä½¿ç¨å¯è½ãªãã©ã³ãä¸è¦§ã調ã¹ã¾ãã import matplotlib.font_manager as fm fm.findSystemFonts() """ âåºåçµæ ['/usr/share/fonts/opentype/ipaexfont-gothic/ipaex
ç®æ¬¡ ã¢ããã¼ã·ã§ã³ æ³å®èªè å®ä½æ¥ Dockerã®ã¤ã³ã¹ãã¼ã« Dockerã¤ã¡ã¼ã¸ã®é¸æã¨åå¾ è¨å®ãããã¹ã¯ã¼ãã®ããã·ã¥æååã®åå¾ ãã¹ã¯ã¼ãã®è¨å®ã¨ãã¡ã¤ã«ã®æ°¸ç¶åãè¡ãããã¼ã¿åæç°å¢ã®Dockerã³ã³ãããèµ·åãã ã¢ããã¼ã·ã§ã³ ãã¼ã¿åæç°å¢æ§ç¯ã¯ãDockerã§ä½ã£ã¦ãã¾ãããã Jupyterã§ãPythonãRãJuliaã使ãããã åè¨èªã®å®çªã©ã¤ãã©ãªãããã±ã¼ã¸ã¯æåããããç¨åº¦å ¥ã£ã¦ãã¦æ¬²ããã æ³å®èªè Dockerã§åºæ¬çãªData Scienceã®ç°å¢ãæ§ç¯ããã人 ãã¾ãDockerãJupyterã«è©³ãããªã人 ç°¡åã«ãã¼ã¿åæç°å¢ãä½ã£ã¦ãã¾ããã人 以ä¸ã®ãããªæ¹ãããã®è¨äºãéãã«ã³ãã³ããå ¥åããã°ããã¼ã¿åæç°å¢ã®æ§ç¯ãåºæ¥ããã¨ãç®æãã¾ãã ç¾å¨ã®ã¨ãããmacOS High Sierraã¨Ubuntu 18.04ã§ãèµ·åã®ç¢ºèª
æ¦è¦ èªåã§ä½æããPythonã®ã¹ã¯ãªãããexeãã¡ã¤ã«(å®è¡ãã¡ã¤ã«)åãã¾ãã Pythonãã¤ã³ã¹ãã¼ã«ããã¦ããªãç°å¢ã§ãä½æããpythonã®ã¹ã¯ãªãããåä½ããããã«ãªãã¾ãã exeãã¡ã¤ã«åãããã¼ã«ã¯ããã¤ãããããã§ãããä»åã¯"pyinstaller"ã使ç¨ãã¾ããã ä»å使ç¨ããç°å¢ Windows7 Pro 64bit Anaconda3 5.0.1(Conda 4.3.30 / Python 3.6.1) æºå Pythonã®pyinstallerã¢ã¸ã¥ã¼ã«ãpipã§ã¤ã³ã¹ãã¼ã«ãã¾ãã 1. Anaconda Promptãèµ·å 2. pipã§pyinstallerã¢ã¸ã¥ã¼ã«ãã¤ã³ã¹ãã¼ã« pip install pyinstaller ã¤ã³ã¹ãã¼ã«ãåºæ¥ãã以ä¸ã§æºåå®äºã§ãã ãã¨ã¯exeãã¡ã¤ã«åãããPythonã®ã¹ã¯ãªãããç¨æãã¦ä¸ããã ä»å
æ¦è¦ 大éã®æç« ãã¡ã¤ã«ãæ±ãã¨ãããã¡ãã¡wordã使ã£ã¦docxã®ä¸èº«ãå¤æ´ããã®ã¯é¢åã Pythonã使ã£ã¦ããç¨åº¦èªååã§ããªããã»ã»ã»ã¨èãã¦èª¿æ»ããã¨ãããç°¡åã«å®è£ ã§ããã®ã§ã¾ã¨ãã¦ããã 対象ã¨ããç°å¢ OSç°åãªã Python2.7 æ¦è¦ 対象ã¨ããç°å¢ python-docxã®å°å ¥ ç½®æããã°ã©ã ä¸è¨ããã°ã©ã ã®GUIãã¼ã«å æ³¨è¨ python-docxã®å°å ¥ pythonã使ã£ã¦docxãã¡ã¤ã«ãåãæ±ãããã«ãpython-docxã¨ããã©ã¤ãã©ãªãå ¬éããã¦ããã®ã§ãã¾ãã¯ãããå°å ¥ããã å°å ¥æ¹æ³ã¯pipã使ãã ããã·ã³ãã«ã pip install python-docx ç½®æããã°ã©ã ã©ã¤ãã©ãªãå°å ¥ã§ãããã以ä¸ã®ãããªã³ã¼ããå®è¡ãããã¨ã§ãç½®æåã®æååãç½®æå¾ã®æååã«ç½®æã§ããã ãããå¿ç¨ãããã¨ã§ãwordã使ã£ãå調ä½æ¥ã®ä¸é¨ããèª
pandas.crosstab()é¢æ°ã使ãã¨ã¯ãã¹éè¨åæãã§ããã ã«ãã´ãªãã¼ã¿ï¼ã«ãã´ãªã«ã«ãã¼ã¿ã質çãã¼ã¿ï¼ã®ã«ãã´ãªãã¨ã®ãµã³ãã«æ°ï¼åºç¾åæ°ã»é »åº¦ï¼ã®ç®åºãªã©ãå¯è½ã pandas.crosstab â pandas 0.22.0 documentation åºç¾åæ°ã§ã¯ãªããã«ãã´ãªãã¨ã®å¹³åå¤ãªã©ãç®åºãããå ´åã¯ãããããã¼ãã«pandas.pivot_table()ã使ãã以ä¸ã®è¨äºãåç §ã é¢é£è¨äº: pandasã®ãããããã¼ãã«ã§ã«ãã´ãªæ¯ã®çµ±è¨éãªã©ãç®åº ããã§ã¯ã pandas.crosstab()é¢æ°ã®åºæ¬çãªä½¿ãæ¹ ã«ãã´ãªãã¨ã®å°è¨ã»ç·è¨ãç®åº: å¼æ°margins å ¨ä½ã»è¡ãã¨ã»åãã¨ã«è¦æ ¼åï¼æ£è¦åï¼: å¼æ°normalize ã«ã¤ãã¦èª¬æããã ä¾ã¨ãã¦ã¿ã¤ã¿ããã¯ã®çåæ å ±ã®ãã¼ã¿ã使ç¨ãããKaggleã®åé¡ãããã¦ã³ãã¼ãã§ããã im
Pythonã§ããã¹ããã¡ã¤ã«å ã®ä»»æã®æååãå«ãè¡ãæ½åºããæ¹æ³ã説æãããããããgrepçãªå¦çã è¡ãæ½åºããåºæ¬çãªæµã è¡ã®ä¸èº«ãæ½åº è¡çªå·ãæ½åº è¡çªå·ã¨è¡ã®ä¸èº«ãæ½åº 該å½ããæåã®è¡ã®ã¿æ½åº è¡ãæ½åºããåºæ¬çãªæµã ããã¹ããã¡ã¤ã«ããæ¡ä»¶ã«å¿ãã¦è¡ãæ½åºããåºæ¬çãªæµãã¯ä»¥ä¸ã®éãã readlines()ã§åè¡ãè¦ç´ ã¨ãããªã¹ããåå¾ ãªã¹ãããæ¡ä»¶ã«å¿ããè¡ãæ½åº 以ä¸ãå ·ä½çãªä¾ã示ãã ããã¹ããã¡ã¤ã«ã®ä¸èº«ããªã¹ãã¨ãã¦åå¾ ä»¥ä¸ã®ãã¡ã¤ã«ãä¾ã¨ããã path = 'data/src/sample_for_grep.txt' with open(path) as f: print(f.read()) # XXX YYY ZZZ # YYY # aaa # XXX # ZZZ XXX # xxx
ãªãªã¼ã¹ãé害æ å ±ãªã©ã®ãµã¼ãã¹ã®ãç¥ãã
ææ°ã®äººæ°ã¨ã³ããªã¼ã®é ä¿¡
å¦çãå®è¡ä¸ã§ã
j次ã®ããã¯ãã¼ã¯
kåã®ããã¯ãã¼ã¯
lãã¨ã§èªã
eã³ã¡ã³ãä¸è¦§ãéã
oãã¼ã¸ãéã
{{#tags}}- {{label}}
{{/tags}}