启动
set LANG=zh_CN.UTF-8 && jupyter notebook --notebook-dir=d:\jupyter\ --ip='*' --NotebookApp.token='' --NotebookApp.password=''
Latex
$x$
from IPython.display import Latex
Latex('$x$')
\(x\)
解方程
import sympy
x=sympy.Symbol('x')
fx=5*x+4
result=fx.evalf(subs={x:6})
x=sympy.Symbol('x')
y=sympy.Symbol('y')
fx=x*x+y*y
result=fx.evalf(subs={x:3,y:4})
x=sympy.Symbol('x')
y=sympy.Symbol('y')
fx=x*3+9
result=sympy.solve(fx,x)
x=sympy.Symbol('x')
y=sympy.Symbol('y')
fx=x*3+y**2
result=sympy.solve(fx,x,y)
x=sympy.Symbol('x')
y=sympy.Symbol('y')
f1=x+y-3
f2=x-y+5
result=sympy.solve([f1,f2],[x,y])
from IPython.display import Latex
a=sympy.Symbol('a')
b=sympy.Symbol('b')
x=sympy.Symbol('x')
y=sympy.Symbol('y')
#simplify( )普通的化简
sympy.simplify((x**3 + x**2 - x - 1)/(x**2 + 2*x + 1))
sympy.latex(((x**3 + x**2 - x - 1)/(x**2 + 2*x + 1)))
# #trigsimp( )三角化简
sympy.trigsimp(sympy.sin(x)/sympy.cos(x))
sympy.latex(sympy.sin(x)/sympy.cos(x))
# #powsimp( )指数化简
sympy.powsimp(x**a*x**b)
sympy.latex(x**a*x**b)
\(\frac{x^{3} + x^{2} - x - 1}{x^{2} + 2 x + 1} \Rightarrow x-1\)
\(\frac{\sin{\left(x \right)}}{\cos{\left(x \right)}} \Rightarrow \tan{\left(x \right)}\)
\(x^{a} x^{b} \Rightarrow x^{a + b}\)
Hive parquet to csv
import os
from pathlib import Path
def file_name(file_dir):
for root, dirs, files in os.walk(file_dir):
for file in files:
if os.path.splitext(file)[-1] == '.parquet':
my_file = Path(os.path.join(root, file+".csv"))
if my_file.is_file()==False:
df=pd.read_parquet(os.path.join(root, file))
df.to_csv(os.path.join(root, file+".csv"))
return
file_name("data/")
迭代运行命令Shell Command line
a=["c","d"]
cc=['']
for b in a:
tmp="{}:\\".format(b)
dd=! dir {tmp}
while dd.__class__.__name__!="SList":
import time
time.sleep(0.001)
cc=cc+dd
print('\r\n'.join(cc))