nan if self.currencies[i] != currency: #通貨単位が異なる場合は、為替データを掛けて通貨単位を揃えておく df_tmp["Adj Close"] = df_tmp["Adj Close"]*ex_list[self.currencies[i]+currency]["Adj Close"] for j in range(0,df_tmp.shape[0]-1): #各行の修正後終値(Adj Close)の値を...
# col1 col2 # 0 100 1 # 1 2 3 # 2 100 5 # 3 100 7 # 4 100 9 このwhereは,条件式が成り立つものをとってきて,それ以外はNaNで埋める. 二つ目の引数は,このNaNになるところをそれで埋める. pandas.Series.where other : scalar, NDFrame, or callable Entries where cond is Fals...
列のタイプを示す numpy 配列 X および dtypes_list を指定すると、浮動小数点を表すストリングの列 (dtypes_list の「float_str」型) を浮動小数点の列に置き換え、その欠落値を np.nan に置き換えます。使用法:autoai_libs.transformers.exportable.FloatStr2Float(dtypes_list, missing_values_...
処理数値を代入して正の数 or 負の数 or ゼロを返す関数numberを定義するifnumber <- function(x){if(x==0){"zero"}else if(x>0){"posi"}else "nega"}c(number(0),number(1),number(-1))"zero" "posi" "nega"ifdef number(x):if x==0:print("zero")elif x>0:print("posi")else :p...
csv.fillna("000",inplace=True)display(csv) csvはうまくいきましたが… xlsx.fillna("000",inplace=True)display(xlsx) json.fillna("000",inplace=True)display(json) xlsxとjsonでは失敗します。 原因 "nan"、"None"という文字列に変換されるためです。 replace()しましょう。