Skip to content

Instantly share code, notes, and snippets.

View AkhilRD's full-sized avatar
🎯
Focusing

Akhil AkhilRD

🎯
Focusing
View GitHub Profile
@AkhilRD
AkhilRD / stock_price.py
Created August 19, 2022 07:25
Extracting multiple stock price data into a single excel sheet
import pandas as pd
import datetime as dt
import time
#tickers as on yahoo finance
tickers = ['BAJFINANCE.NS','CHOLAFIN.NS','CUB.BO','DCBBANK.NS','DHANBANK.BO','EDELWEISS.NS','HDFCBANK.NS','ICICIBANK.NS',
'IDFC.NS','KOTAKBANK.BO','L&TFH.NS','MANAPPURAM.BO','MUTHOOTFIN.BO','RELCAPITAL.BO','SBIN.BO','KTKBANK.BO',
'KARURVYSYA.NS','SOUTHBANK.BO','YESBANK.BO','MOTILALOFS.NS']
#interval: 1d or 1mo
interval = '1d'
@AkhilRD
AkhilRD / text_pre-processing.py
Created August 11, 2022 06:38
A function that helps in pre-processing textual data and retrieve sentiment score in a pandas data-frame.
from nltk.tokenize import sent_tokenize
from nltk.stem import WordNetLemmatizer
from nltk.corpus import stopwords
import unicodedata
import nltk
import re
from vaderSentiment.vaderSentiment import SentimentIntensityAnalyzer
#function
@AkhilRD
AkhilRD / gin-scraping.py
Last active August 11, 2022 06:43
A scraping code that scrapes Gin's from the whiskey exchange website and builds a data-frame to analyse findings further.
from bs4 import BeautifulSoup
import requests
import re
import pandas as pd
baseurl ="https://www.thewhiskyexchange.com/"
url ="https://www.thewhiskyexchange.com/c/338/gin"
source = requests.get(url)
soup = BeautifulSoup(source.content,'lxml')
@AkhilRD
AkhilRD / twitter_scraper.py
Last active August 11, 2022 08:21
Scraping tweets with 10 lines of code
# Importing the libraries
import snscrape.modules.twitter as sntwitter
import pandas as pd
# Query and creating an empty list for storing tweets
query = "MSFT Microsoft min_faves:100 lang:en until:2022-06-30 since:2022-01-01"
tweets = []
# A simple for loop
for tweet in sntwitter.TwitterSearchScraper(query).get_items():