Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save keNzi/727b682c2ab020356b36da542a262d17 to your computer and use it in GitHub Desktop.
Save keNzi/727b682c2ab020356b36da542a262d17 to your computer and use it in GitHub Desktop.
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')
end_date = pd.to_datetime('2024-07-31')
# Filter data by date
filtered_df = df[(df['Date'] >= start_date) & (df['Date'] <= end_date)]
# Count the number of rows in the column
column_name = "Mail"
count = filtered_df[column_name].count()
# Print the count
print(f"Number of rows in {column_name} column within the specified period: {count}")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment