feaet: now cycles through wanted files

This commit is contained in:
Leonard Excoffier
2024-08-31 15:41:33 -04:00
parent f31d901201
commit 3a60674b7c

View File

@@ -1,18 +1,29 @@
import pandas as pd import pandas as pd
# Read the data into a Pandas DataFrame # Define a list of file paths for easy modification
file_path = 'sec_data/2024q1/tag.txt' file_paths = [
df = pd.read_csv(file_path, sep='\t') 'sec_data/2024q1/num.txt',
'sec_data/2024q1/pre.txt',
'sec_data/2024q1/sub.txt',
'sec_data/2024q1/tag.txt'
]
# Inspect the DataFrame # Loop through each file and perform analysis
print("First rows of the DataFrame:") for i, file_path in enumerate(file_paths):
print(df.head(10)) print(f"\nAnalyzing {file_path} (File {i+1}/4)...")
# Get the DataFrame Information # Read the data into a Pandas DataFrame
print("\nSummary Information:") df = pd.read_csv(file_path, sep='\t')
print(df.info())
# Inspect the DataFrame
# Check if there are any missing values in the DataFrame print("First rows of the DataFrame:")
missing_values = df.isnull().sum() print(df.head(10))
print("\nMissing Values:")
print(missing_values) # Get the DataFrame Information
print("\nSummary Information:")
print(df.info())
# Check if there are any missing values in the DataFrame
missing_values = df.isnull().sum()
print("\nMissing Values:")
print(missing_values)