Skip to content

Instantly share code, notes, and snippets.

View keNzi's full-sized avatar
🎯
Focusing

keNzi keNzi

🎯
Focusing
View GitHub Profile
import pandas as pd
# Specify the CSV file path
csv_file_path = "C:\projects\webflow\forms_data\email-form-2024-06-28.csv" # this need to be changed to your file path
# Read the CSV file with date format specified for 'Date' column
df = pd.read_csv(csv_file_path, parse_dates=['Date'], date_format='%m/%d/%Y %I:%M:%S %p')
# Set the specific period of time
start_date = pd.to_datetime('2024-07-01')
@keNzi
keNzi / ga4_reports.py
Created February 20, 2024 09:18
retrieve GA4 data using API with UTF-8 metrics name. Save to JSON file using Pandas DataFrame
import os
import pandas as pd
from google.analytics.data_v1beta import BetaAnalyticsDataClient
from google.analytics.data_v1beta.types import (
DateRange,
Dimension,
Metric,
MetricType,
@keNzi
keNzi / find_most_common_number
Last active May 13, 2018 15:16
find most common number
numbers = [1, 2, 3, 2, 2, 2, 2, 2, 9, 1]
def find_most_common_number(numbers):
from collections import Counter
return print(Counter(numbers).most_common(1)[0][0])
def find_most_common_number(numbers):
count_list = [[x, numbers.count(x)] for x in set(numbers)]
def xmassTree(floors):
for x in [z for z in range(1, floors * 2 + 1, 2)]:
floors -= 1
print(' ' * floors, '*' * x)
xmassTree(5)
def xmasttree(count):