Skip to content

Instantly share code, notes, and snippets.

View kumar1202's full-sized avatar
🌱
Learning

Kumar Abhijeet kumar1202

🌱
Learning
View GitHub Profile
HCL 33 mins █████████▏░░░░░░░░░░░ 44.0%
Markdown 13 mins ███▋░░░░░░░░░░░░░░░░░ 17.3%
YAML 10 mins ██▊░░░░░░░░░░░░░░░░░░ 13.7%
Ruby 10 mins ██▊░░░░░░░░░░░░░░░░░░ 13.2%
Bash 8 mins ██▎░░░░░░░░░░░░░░░░░░ 11.0%
class SendEmailJob < ActiveJob::Base
queue_as :default
def perform(body, email)
Mailer.send(body, email)
end
end
require 'rails_helper'
RSpec.describe SendEmailJob, type: :job do
let(:Mailer) { create(:Mailer) }
let(:email) { "test@go-jek.com" }
let(:body) { "Hello World" }
it 'enqueues itself on default queue' do
ActiveJob::Base.queue_adapter = :test
expect { SendEmailJob.perform_async(email, body) }
# Adding columns as index
df.set_index('column_name')
# Dropping columns or rows
df.drop(['x1','x2'],axis = (1 or 0))
# For one-hot encoding string categorical data
from numpy import array
from numpy import argmax
from sklearn.preprocessing import LabelEncoder
from sklearn.preprocessing import OneHotEncoder
# define example
data = ['cold', 'cold', 'warm', 'cold', 'hot', 'hot', 'warm', 'cold', 'warm', 'hot']
values = array(data)
print(values)
# integer encode