Skip to content

Instantly share code, notes, and snippets.

View natyrix's full-sized avatar

Natnael Melese natyrix

View GitHub Profile
import pandas as pd
import re
class Clean_Tweets:
"""
The PEP8 Standard AMAZING!!!
"""
def __init__(self, df: pd.DataFrame):
self.df = df
print('Clean_Tweets INSTANCE CREATED')
import json
import pandas as pd
from textblob import TextBlob
import re
def read_json(json_file: str) -> list:
"""
json file reader to open and read json files into a list
Args:
import unittest
import pandas as pd
import sys
import os
sys.path.append(os.path.abspath(os.path.join("../Twitter-Data-Analysis/")))
from extract_dataframe import read_json
from extract_dataframe import TweetDfExtractor
# For unit testing the data reading and processing codes,
name: twitter-data-analysis
on:
push:
branches: [main]
pull_request:
branches: [main]
permissions:
contents: read
CREATE TABLE IF NOT EXISTS `TweetInformation`
(
`id` INT NOT NULL AUTO_INCREMENT,
`created_at` TEXT NOT NULL,
`source` VARCHAR(200) NOT NULL,
`full_text` TEXT DEFAULT NULL,
`polarity` FLOAT DEFAULT NULL,
`subjectivity` FLOAT DEFAULT NULL,
`language` TEXT DEFAULT NULL,
`favorite_count` INT DEFAULT NULL,
import os
import pandas as pd
import mysql.connector as mysql
from mysql.connector import Error
def DBConnect(dbName=None):
"""
Parameters
----------
import numpy as np
import pandas as pd
import streamlit as st
import altair as alt
from wordcloud import WordCloud
import plotly.express as px
from textblob import TextBlob
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
import pickle
from pages.plots import *
import numpy as np
import pandas as pd
import streamlit as st
import altair as alt
from wordcloud import WordCloud
import plotly.express as px
from textblob import TextBlob
from sklearn.feature_extraction.text import CountVectorizer, TfidfTransformer
import pickle
import unittest
import pandas as pd
import sys
import os
sys.path.append(os.path.abspath(os.path.join("../Twitter-Data-Analysis/")))
from extract_dataframe import read_json
from extract_dataframe import TweetDfExtractor
from clean_tweets_dataframe import Clean_Tweets
class VectorbotPipeline():
def __init__(self,user_id, indicator="sma",init_cash=1000, ema_value=0,stock='AMZN', fast_ma=10, slow_ma=50, start='2021-10-11', end='2022-10-11', period=None, fees=0.005, is_experiment=False):
self.user_id = user_id
self.init_cash = init_cash
self.ema_value = ema_value
self.indicator = indicator
self.stock = stock
self.fast_ma = fast_ma
self.slow_ma = slow_ma
self.start = start