Skip to content

Instantly share code, notes, and snippets.

View HarunMbaabu's full-sized avatar
🎯
Focusing

Harun Mbaabu HarunMbaabu

🎯
Focusing
View GitHub Profile
@HarunMbaabu
HarunMbaabu / Senior Analytics Engineer Question.md
Created July 3, 2023 14:44
Senior Analytics Engineer Question.md

To calculate the rolling 3-day average of the total transaction amount processed per day for January 31, we need to retrieve the transaction amounts for January 29, January 30, and January 31, and then calculate their average.

SELECT
  DATE(transaction_time) AS date,
  AVG(transaction_amount) AS rolling_avg
FROM transactions
WHERE DATE(transaction_time) BETWEEN '2021-01-29' AND '2021-01-31'
GROUP BY DATE(transaction_time)
HAVING COUNT(*) = 3

The error message "OSError: [Errno 98] Address already in use" typically occurs when the port you are trying to use for your Flask application is already being used by another process. By default, Flask uses port 5000.

To resolve this issue, you can try the following solutions:

1). Change the port number: Specify a different port number in your Flask script by modifying the app.run() statement. For example, you can use app.run(port=5001) to run the Flask application on port 5001 instead of the default 5000.

if __name__ == '__main__':
    app.run(port=5001, debug=True

Here is an example of building a neural network model for creditworthiness prediction using Python and the Keras library:

import pandas as pd
import numpy as np
from keras.models import Sequential
from keras.layers import Dense
from sklearn.model_selection import train_test_split

Python is an interpreted, high-level language created by Guido van Rossum and released in 1991. It is dynamically typed and garbage collected.

Python programs have the extension .py and can be run from the command line by typing python file_name.py.

Probably its most noticeable characteristic is its use of significant white space to delimit code blocks, instead of the more popular {} symbols.

End-of-line semicolons (;) are optional and usually not used in Python.

Python becomes the best solution in many domains from web applications, data analysis, data science, machine learning, and AI.

Github has made changes in password authentication. If you are trying to access git by username and password then it does not allow you. So use a personal access token instead of a password to access git.
Here are steps to generate Personal access tokens.
Click Here - https://github.com/settings/tokens
Step 1 - Open GitHub and log in with your credentials.
from flask import Flask, render_template, request
from flaskext.mysql import MySQL


app = Flask(__name__)


app.config['MYSQL_HOST'] = 'localhost'

Python Boot Camp : Python Basics & Concepts.

Python is an interpreted, high-level language created by Guido van Rossum and released in 1991. It is dynamically typed and garbage collected.

Python programs have the extension .py and can be run from the command line by typing python file_name.py.

Probably its most noticeable characteristic is its use of significant white space to delimit code blocks, instead of the more popular {} symbols.

End-of-line semicolons (;) are optional and usually not used in Python.

To automate your slack instance invites:

1. Create a google form with two text fields:

  • "Your email"
  • "Who invite you"

2. You will get a google table with responses and 3 fields:

  • "Timestamp"
import pandas as pd
import streamlit as st
import plotly.express as px

@st.cache
def get_data():
    return pd.read_csv("http://data.insideairbnb.com/united-states/ny/new-york-city/2019-09-12/visualisations/listings.csv")
# Write Python3 code here
# Importing the libraries
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
   
# Importing the dataset
dataset = pd.read_csv('Churn_Modelling.csv')
X = dataset.iloc[:, 3:13].values