Author: 儲蓄保險王
Python:如何用pandas.concat() 合併兩個DataFrame並重置index? pd.concat([df1, df2]) .reset_index(drop=True) ; pd.concat([df1, df2], ignore_index=True)
import pandas as pd # 建立兩個 DataFra...
Python: 如何用pandas.read_csv() 讀取逗點分隔檔並忽略空列,跳過某些列? dfRaw = pd.read_csv (fpath, skip_blank_lines = True, skiprows =6)
原始資料最末兩列為空列(注意鼠標位置): 首6列則為非屬資料的部分 ...
Python如何使用chardet.detect() 偵測編碼(encoding)? #”charset(字符集) detection”
chardet 的英文字縮寫是 “charset(字符集...
Python:使用struct() 對二進位數據打包、解包 data = struct.pack (format_str, 1, 2, 3.14) ; result = struct.unpack (format_str, data) ; numpy.fromfile() ;
struct 是 Python 標準函式庫中用於二進位數據打包、解包...
Python: 如何用seaborn (sns) 套件繪製具有多個子圖的散佈圖且限定欄數?g = sns.relplot (data=tips, x=”total_bill”, y=”tip”, col=”day”, hue=”sex”,col_wrap=2, kind=”line”)
import seaborn as sns import matpl...
Python: matplotlib繪圖如何共用x axis, y axis, x label, ylabel? fig, axs = plt.subplots(nrows=2, ncols=3, sharex=True, sharey=True) ; plt.suplabel()
import matplotlib.pyplot as plt im...
Python bool vs numpy.bool_ 布林(True/False); 對於np.bool_ 做乘法等效於and ; 對於np.bool_ 做加法等效於or
Python邏輯運算子: and or xor(^) not: 對布...

近期留言