Created
July 14, 2024 09:52
-
-
Save keNzi/727b682c2ab020356b36da542a262d17 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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