Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
thecleverprogrammer.com

Aman Kharwal amankharwal

💭
thecleverprogrammer.com
View GitHub Profile
View titanic.csv
PassengerId Survived Pclass Name Sex Age SibSp Parch Ticket Fare Cabin Embarked
1 0 3 Braund, Mr. Owen Harris male 22 1 0 A/5 21171 7.25 S
2 1 1 Cumings, Mrs. John Bradley (Florence Briggs Thayer) female 38 1 0 PC 17599 71.2833 C85 C
3 1 3 Heikkinen, Miss. Laina female 26 0 0 STON/O2. 3101282 7.925 S
4 1 1 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35 1 0 113803 53.1 C123 S
5 0 3 Allen, Mr. William Henry male 35 0 0 373450 8.05 S
6 0 3 Moran, Mr. James male 0 0 330877 8.4583 Q
7 0 1 McCarthy, Mr. Timothy J male 54 0 0 17463 51.8625 E46 S
8 0 3 Palsson, Master. Gosta Leonard male 2 3 1 349909 21.075 S
9 1 3 Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg) female 27 0 2 347742 11.1333 S
View titanic.csv
PassengerId Survived Pclass Name Sex Age SibSp Parch Ticket Fare Cabin Embarked
1 0 3 Braund, Mr. Owen Harris male 22 1 0 A/5 21171 7.25 S
2 1 1 Cumings, Mrs. John Bradley (Florence Briggs Thayer) female 38 1 0 PC 17599 71.2833 C85 C
3 1 3 Heikkinen, Miss. Laina female 26 0 0 STON/O2. 3101282 7.925 S
4 1 1 Futrelle, Mrs. Jacques Heath (Lily May Peel) female 35 1 0 113803 53.1 C123 S
5 0 3 Allen, Mr. William Henry male 35 0 0 373450 8.05 S
6 0 3 Moran, Mr. James male 0 0 330877 8.4583 Q
7 0 1 McCarthy, Mr. Timothy J male 54 0 0 17463 51.8625 E46 S
8 0 3 Palsson, Master. Gosta Leonard male 2 3 1 349909 21.075 S
9 1 3 Johnson, Mrs. Oscar W (Elisabeth Vilhelmina Berg) female 27 0 2 347742 11.1333 S
View telegram bot
import requests
import json
def summary(update, context):
response = requests.get('https://api.covid19api.com/summary')
if(response.status_code==200): #Everything went okay, we have the data
data = response.json()
print(data['Global'])
context.bot.send_message(chat_id=update.effective_chat.id, text=data['Global'])
else: #something went wrong
context.bot.send_message(chat_id=update.effective_chat.id, text="Error, something went wrong.")
View telegram bot
hello_handler = CommandHandler('hello', hello)
dispatcher.add_handler(hello_handler)
View telegram bot
def hello(update, context):
context.bot.send_message(chat_id=update.effective_chat.id, text='Hello, World')
View telegram bot
from telegram.ext import Updater, CommandHandler, MessageHandler, Filters
updater = Updater(token='TOKEN', use_context=True) #Replace TOKEN with your token string
dispatcher = updater.dispatcher
View Bubble Plots
plt.figure(figsize=(12, 8))
plt.scatter(years, Brazil,
c=c_br,
alpha=0.5,
s = b_normal * 2000)
plt.xlabel("Years", size=14)
plt.ylabel("Number of immigrants of Brazil", size=14)
View Bubble Plots
plt.figure(figsize=(12, 8))
plt.scatter(years, Brazil,
c=c_br,
alpha=0.5,
s = b_normal * 2000)
plt.scatter(years, India,
c=c_fr,
alpha=0.5,
s = i_normal * 2000,
)
View Bubble Plots
plt.figure(figsize=(12, 8))
plt.scatter(years, Brazil,
color='darkblue',
alpha=0.5,
s = b_normal * 2000)
plt.scatter(years, India,
color='purple',
alpha=0.5,
s = i_normal * 2000,
)
View gist:7094bf5880b685b386aa97d0e94401bb
i_normal = India / India.max()
b_normal = Brazil / Brazil.max()
years = list(range(1980, 2014))
import matplotlib.pyplot as plt
plt.figure(figsize=(14, 8))
plt.scatter(years, India, color='blue')
plt.scatter(years, Brazil, color='orange')
plt.xlabel("Years", size=14)
plt.ylabel("Number of immigrants", size=14)
plt.show()