Skip to content

Instantly share code, notes, and snippets.

from graphviz import Digraph
class PedIndex():
"""
0以上の整数を入力してそれに対応する血統上の親を出力する。
ped_indexナンバリング方法 : 父(0)、母(1)、父父(2)、父母(3)、母父(4)、母母(5)、父父父(6)、父父母(7)、父母父(8)、父母母(9)、...
"""
def __init__(self, ped_index: int=0):
self.set_ped_index(ped_index)
# ファイル名を一括置換する
import os
import glob
def get_file_name_list(files, path):
return [s.replace(path[:-1], '').replace('/', '').replace('\\' , '') for s in files]
before_word = '東京'
after_word = 'tokyo'
dir_path = 'C:/Users/potass/' # ファイルのあるディレクトリ名
Option Explicit
Sub Plot_Move()
Dim i As Long
Dim t As Long
Dim PLOT_DATA_NUM As Long
Dim INTERVAL_msec As Long
PLOT_DATA_NUM = 15
Option Explicit
Const IntervalSld As Double = 2.5 'スライド切替時間[sec]
Const NumSelectSld As Long = 3 '日ごとに選択するスライド総数
Dim d0 As Date 'マクロ開始時の日付
Dim j0 As Long '日付d0での選択スライドの番号
'スライドショー実行(メイン)
Sub MainLoop()
Option Explicit
Sub sample_ReadWordFromExcelVBA()
' ファイル名、拡張子検索用
Dim objFso As Object
Dim objF As Object
Dim dir As String
Dim ext As String
Dim filelist() As String
Dim picktag As String
# coding: utf-8
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
alpha = 5.0e-03
beta = 11.1
def makems(m, dataset):
Phi = np.array([dataset.x.values**k for k in range(0, m+1)])
# coding: utf-8
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def y(w, x):
y = 0.
for i, ww in enumerate(w):
y += ww*(x**i)
return y
# coding: utf-8
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def y(w, x):
y = 0.
for i, ww in enumerate(w):
y += ww*(x**i)
return y
# coding: utf-8
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def main():
M = 9
N = [15, 100]
sigma = 0.3
# coding: utf-8
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def rms(p, df):
error = 0.
for index, list in df.iterrows():
error += 0.5*(np.polyval(p, list.x)-list.t)**2
return np.sqrt(2.*error/len(df))