This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class TimeMatrixCase( | |
userId: Long, | |
windowDateList: List[String], | |
sourceCellIdPlaceId: Map[String, Int], | |
timeMatrix: List[List[Int]], | |
time_map: Map[String, Int], | |
weekdayDaySeconds: Map[String, Int], | |
weekdayEveningSeconds: Map[String, Int], | |
weekendDaySeconds: Map[String, Int], | |
weekendEveningSeconds: Map[String, Int], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from networkx.drawing.nx_agraph import graphviz_layout, to_agraph | |
from PIL import Image | |
from io import BytesIO | |
A = to_agraph(g2) | |
A.layout(prog='dot') | |
# graphviz_layout(prog=neato) | |
img = A.draw(format='png') | |
image = Image.open(BytesIO(img)) | |
image.show(title="Graph") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
大集群: hdfs://10.244.12.215:8020 | |
小集群: hdfs://10.244.12.75:8020 | |
花园集群: hdfs://10.244.13.106:8020 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#bash command completion | |
source <(sq completion bash) | |
#add source | |
sq add ./CBDB_20200528.db -h @cbdb_20200528 | |
#list source | |
sq ls | |
#inspecting, list table names |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import scala.math.Integral.Implicits._ | |
def location2utm(location_id:Long):(Long,Long,Long) = { | |
// convert a location id to utm coordination | |
// THIS IS THE UTM VALUE AS IS IN SS OUTPUTS. TO GET CORRECTED UTM/LAT-LON USE sstool.ssutm.SSUtm | |
// return a tuple of (x, y, size) as left-bottom corner of a rectange | |
// if location_id < 100000000000: | |
// return None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#itables | |
from itables import init_notebook_mode | |
init_notebook_mode(all_interactive=True) | |
import world_bank_data as wb | |
df = wb.get_countries() | |
df | |
#qgrid | |
qgrid.show... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#pynb-code, show all codes in a jupyter notebook | |
jq -j '.cells | map( select(.cell_type == "code") | .source +["\n\n"]) | .[][] ' $@ | |
#beautify code in notebook and copy to clipboard as rich text | |
pynb-code xxx.ipynb |pygmentize -f rtf | xclip -t text/rtf -selection clipboard | |
#find print | |
find . -name "*.ipynb" -exec pynb-code {} + | |
#find grep |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Overlapping densities ('ridge plot') | |
==================================== | |
""" | |
import numpy as np | |
import pandas as pd | |
import seaborn as sns | |
import matplotlib.pyplot as plt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#to csv | |
#via csvkit | |
in2csv --sheet 区县级 基站工参统计.xlsx #to stdout | |
# via Gnumeric | |
ssconvert -T Gnumeric_stf:stf_csv 基站工参统计.xlsx | |
#select columns | |
in2csv --sheet 区县级 基站工参统计.xlsx |csvcut -c "城市名称","人数" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# via Tesseract | |
pdfsandwich -lang chi_sim zgsy.pdf | |
#merging pages | |
pdftk A=zgsy.pdf B=zgsy_ocr.pdf cat A1 B2-27 A28 B29-57 A58 B59-140 A141 B142-end output zzz.pdf |
NewerOlder