Skip to content

Instantly share code, notes, and snippets.

orangain

Block or report user

Report or block orangain

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@orangain
orangain / adjust_splits.py
Created Sep 15, 2019
pandasで株式分割・併合に伴う株価調整
View adjust_splits.py
import pandas as pd
dfs = pd.read_html('https://srbrnote.work/archives/2338')
df_splits = dfs[0] # 株式分割・併合データ
df_stocks = dfs[2] # 株価データ
df_splits['分割日'] = pd.to_datetime(df_splits['分割日'])
df_splits['係数'] = df_splits['分割前'] / df_splits['分割後']
df_stocks['日付'] = pd.to_datetime(df_stocks['日付'])
@orangain
orangain / amazon_order_history.py
Created Nov 14, 2017
werkzeug.exceptions.BadRequestKeyErrorになる問題に対応したamazon_order_history.py
View amazon_order_history.py
import sys
import os
from robobrowser import RoboBrowser
# 認証の情報は環境変数から取得する。
AMAZON_EMAIL = os.environ['AMAZON_EMAIL']
AMAZON_PASSWORD = os.environ['AMAZON_PASSWORD']
# RoboBrowserオブジェクトを作成する。
@orangain
orangain / README.md
Last active Jun 26, 2017
テーブルからのスクレイピング
View README.md

準備

$ python3 -m venv scraping
$ . venv/bin/activate
(venv) $ pip install scrapy

実行

@orangain
orangain / README.md
Last active Jun 18, 2016
Difference of extracted contents between Python 2 and 3
View README.md

Command to extract contents

$ python2 --version
Python 2.7.11
$ python3 --version
Python 3.5.1
$ git checkout master
$ python2 WikiExtractor.py --lists --links -b 100M in/jawiki-20150805-pages-articles.xml.bz2 -o out-py2-master
$ git checkout support-python3
@orangain
orangain / README.md
Last active Mar 16, 2016
Testing non-ASCII URLs with simple spiders.
View README.md

In my environment these spiders work well.

Environment:

(venv) $ python -V
Python 3.4.2
(venv) $ scrapy version
Scrapy 1.1.0rc3
@orangain
orangain / 01 - Mac OS X script to automatically start docker vm on system boot.md
Last active Jan 22, 2016
Mac OS X script to start Docker VM automatically on system boot
View 01 - Mac OS X script to automatically start docker vm on system boot.md

Setup

  1. Download com.docker.vm.plist and save it into ~/Library/LaunchAgents/.

    $ curl -sL https://git.io/vz2Y9 -o ~/Library/LaunchAgents/com.docker.vm.plist
    
  2. (Optional) Change <string>default</string> line if you are using different name of docker machine.

@orangain
orangain / 0_reuse_code.js
Created Jan 13, 2016
Here are some things you can do with Gists in GistBox.
View 0_reuse_code.js
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
View museums.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View test_spider.py
# coding: utf-8
from __future__ import print_function
import scrapy
class TestSpider(scrapy.Spider):
name = 'test'
allowed_domains = ['capybala.com']
start_urls = (
View valid_meshcodes.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.