2018-06-13から1日間の記事一覧
環境 Python 3.6 pandas '0.23.0' 症状 適当に model = RandomForestRegressor.fit(x_train, y_train) とかしてると DataConversionWarning: A column-vector y was passed when a 1d array was expected. Please change the shape of y to (n_samples, ), f…
自分用メモ INTO OUTFILEを使う場合 MySQLサーバーがオンプレミスの場合はこっち SELECT * FROM users INTO OUTFILE '/tmp/users.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'; スクリプト経由で出力する場合 クラウドのサーバーだと権限的にI…
常識すぎるのか、ググってもなかなか出てこなかったのでメモ 可変長引数とは rubyでは仮引数名の頭に「*」をつけると可変長で受け取ることができる。 def myfunc(*args) p args end myfunc(1, "hello", true) # => [1, "hello", true] 問題点 が、ここで配列…
結論 reversible do |direction| direction.up { execute "ALTER TABLE battles ADD PRIMARY KEY (id);" } end 環境 Rails 5.2 Ruby 2.4 なぜつけるのか railsのマイグレーションでindexつけたりとか特殊なことをしようとするときはexecute()を使うこともあ…