Skip to content

Instantly share code, notes, and snippets.

View scott-hsieh's full-sized avatar

scott.hsieh scott-hsieh

View GitHub Profile
@scott-hsieh
scott-hsieh / .sh
Created November 20, 2020 03:13
Remove Xcode Command Lines
sudo rm -rf /Library/Developer/CommandLineTools
@scott-hsieh
scott-hsieh / .txt
Last active November 20, 2020 03:26
Failure Message of Compiing Python 3.8.6 on macOS Big Sur
File "/private/var/folders/4y/wmknhd9j2nvbt_pdvsvcylxm0000gn/T/python-build.20201120094748.9372/Python-3.8.6/Lib/runpy.py", line 111, in _get_module_details
__import__(pkg_name)
File "<frozen zipimport>", line 241, in load_module
File "<frozen zipimport>", line 709, in _get_module_code
File "<frozen zipimport>", line 570, in _get_data
zipimport.ZipImportError: can't decompress data; zlib not available
make: *** [install] Error 1
@scott-hsieh
scott-hsieh / .txt
Created November 20, 2020 03:49
Unavailability of _bz2 When Importing Pandas
File "/Users/scott.hsieh/.pyenv/versions/3.8.6/lib/python3.8/bz2.py", line 19, in <module>
from _bz2 import BZ2Compressor, BZ2Decompressor
ModuleNotFoundError: No module named '_bz2'
@scott-hsieh
scott-hsieh / .sh
Last active December 12, 2020 00:29
Compile Python 3.8.6 on MacBook with Big Sur
CPPFLAGS="-I$(brew --prefix zlib)/include -I$(brew --prefix bzip2)/include" && \
CFLAGS="-I$(brew --prefix openssl)/include -I$(brew --prefix readline)/include" && \
LDFLAGS="-L$(brew --prefix openssl)/lib -L$(brew --prefix readline)/lib -L$(brew --prefix zlib)/lib -L$(brew --prefix bzip2)/lib" && \
pyenv install -v 3.8.6
@scott-hsieh
scott-hsieh / pyspark_dependenceis_1.py
Created April 10, 2021 02:02
如何在 PySpark 中管理 Python 相依性套件
import pandas as pd
from pyspark.sql.functions import pandas_udf
@pandas_udf('double')
def pandas_plus_one(v: pd.Series) -> pd.Series:
return v + 1
spark.range(10).select(pandas_plus_one("id")).show()