open -Fna /Applications/MySQLWorkbench.app/Contents/MacOS/MySQLWorkbench
from: https://stackoverflow.com/questions/21235894/how-to-open-multiple-model-database-in-mysql-workbench
import numpy as np | |
import matplotlib.pyplot as plt | |
x = np.linspace(0, 50, 3001) | |
y = np.sin(3*x) | |
delta_x = x[1] | |
def second_order_central_fd(y, delta_x): | |
""" | |
Return the second order central finite difference of a vector (i.e. d^2 y/ dx^2). | |
Zero fills rollover. What it should probably do is a single order FDA | |
or interpolate the endpoints. |
ax1.set_zorder(ax2.get_zorder()+1) # put ax in front of ax2 | |
ax1.patch.set_visible(False) # hide the 'canvas' | |
from: http://matplotlib.1069221.n5.nabble.com/Control-twinx-series-zorder-ax2-series-behind-ax1-series-or-place-ax2-on-left-ax1-on-right-td12994.html |
import matplotlib.pyplot as plt | |
import pandas as pd | |
import numpy as np | |
a = pd.DataFrame({'a':[0.25, 0.5, 0.15, 0], 'b':[0.15, 0.25, 0.35, 0.15], | |
'c':[0.50, 0.15, 0.5, 0.35], 'd':[0.35, 0.35, 0.25, 0.5],}) | |
fig, ax = plt.subplots() | |
x = a.index | |
indexes = np.argsort(a.values).T | |
heights = np.sort(a.values).T | |
order = -1 |
from functools import wraps | |
STRING1_LIST = ['A', 'B', 'C'] | |
STRING2_LIST = ['D', 'E', 'F'] | |
def type_checker(int1=None, string1=None, string2=None): | |
""" Decorator function to check if int1 is an int and | |
that string1 or string2 supplied is actually a valid string | |
""" | |
if string1: | |
s = 'string1' | |
list_to_find_in = STRING1_LIST |
# Your init script | |
# | |
# Atom will evaluate this file each time a new window is opened. It is run | |
# after packages are loaded/activated and after the previous editor state | |
# has been restored. | |
# | |
# An example hack to log to the console when each text editor is saved. | |
# | |
# atom.workspace.observeTextEditors (editor) -> | |
# editor.onDidSave -> |
def A003417(): | |
n = 0 | |
while True: | |
if n == 0: | |
yield 2 | |
if n == 1: | |
yield 1 | |
else: | |
if (n+1) % 3 == 0: | |
yield int(2 * ((n+1) / 3)) |
# UPDATE: He re-added the question here: https://stackoverflow.com/questions/52048919/how-to-incrementally-add-linear-regression-column-to-pandas-dataframe/52068085#52068085 | |
# Some guy had this weird question on Stack Overflow about cummulatively applying linear regression to a dataframe | |
# He deleted the question (I don't think this operation is very useful), but I figured out a way to do it here: | |
# Pretty wacky | |
from io import StringIO | |
import pandas as pd | |
import numpy as np | |
df = pd.read_table(StringIO(""" a b |
open -Fna /Applications/MySQLWorkbench.app/Contents/MacOS/MySQLWorkbench
from: https://stackoverflow.com/questions/21235894/how-to-open-multiple-model-database-in-mysql-workbench
import logging | |
import time | |
import numpy as np | |
def prog_log(logger, percentage, pwidth=20, pchar="#"): | |
""" Take a logger object and percentage and output a | |
progress bar to the log | |
""" | |
original_format = logger.handlers[0].formatter | |
logger.info("Progress:") |
from googletrans import Translator | |
import pandas as pd | |
translator = Translator() | |
df = pd.DataFrame({'Spanish':['piso','cama']}) | |
df['English'] = df['Spanish'].apply(translator.translate, src='es', dest='en').apply(getattr, args=('text',)) |