I hereby claim:
- I am bact on github.
- I am bact (https://keybase.io/bact) on keybase.
- I have a public key ASA8vzg-kfcvZpfOGoeTXJR8gVCxI4B3NQ3I8H8JQ15B8Ao
To claim this, I am signing this object:
# 1) export text from JSON | |
import json | |
import pandas as pd | |
from pandas import json_normalize | |
# note: have to remove `window.YTD...` in the first line | |
data = json.load(open('bact-tweet.json')) | |
df = pd.DataFrame.from_records(json_normalize(data)) | |
df = df[df["tweet.lang"] == "th"] |
_THAI_ARABIC = { | |
"๐": "0", | |
"๑": "1", | |
"๒": "2", | |
"๓": "3", | |
"๔": "4", | |
"๕": "5", | |
"๖": "6", | |
"๗": "7", | |
"๘": "8", |
# thai_strftime() | |
# Thai date and time string formatter | |
# Formatting directives similar to datetime.strftime() | |
# | |
# จัดรูปแบบข้อความวันที่และเวลา แบบเดียวกับ datetime.strftime() | |
# โดยจะใช้ชื่อเดือนเป็นภาษาไทย และปีเป็นพุทธศักราช | |
# (ไม่รองรับปีก่อน พ.ศ. 2484 - ก่อนการเปลี่ยนวันปีใหม่ไทย) | |
# | |
# No Rights Reserved | |
# PUBLIC DOMAIN or CC0 1.0 Universal |
def is_one_swap_can_sort(nums): | |
sorted_nums = sorted(nums) | |
if nums == sorted_nums: | |
return True | |
len_nums = len(nums) | |
for i in range(len_nums): | |
for j in range(i+1, len_nums): | |
test = nums.copy() | |
if test[i] > test[j]: |
import re | |
def bingap(num): # wronggggg | |
zeroes = re.findall(r"0+", bin(num)[2:]) | |
return len(max(zeroes, key=len)) if zeroes else 0 | |
n = 32 | |
print(bin(n)) | |
bingap(n) |
I hereby claim:
To claim this, I am signing this object: