feaet: now cycles through wanted files
This commit is contained in:
@@ -1,18 +1,29 @@
|
||||
import pandas as pd
|
||||
|
||||
# Read the data into a Pandas DataFrame
|
||||
file_path = 'sec_data/2024q1/tag.txt'
|
||||
df = pd.read_csv(file_path, sep='\t')
|
||||
# Define a list of file paths for easy modification
|
||||
file_paths = [
|
||||
'sec_data/2024q1/num.txt',
|
||||
'sec_data/2024q1/pre.txt',
|
||||
'sec_data/2024q1/sub.txt',
|
||||
'sec_data/2024q1/tag.txt'
|
||||
]
|
||||
|
||||
# Inspect the DataFrame
|
||||
print("First rows of the DataFrame:")
|
||||
print(df.head(10))
|
||||
|
||||
# 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)
|
||||
# Loop through each file and perform analysis
|
||||
for i, file_path in enumerate(file_paths):
|
||||
print(f"\nAnalyzing {file_path} (File {i+1}/4)...")
|
||||
|
||||
# Read the data into a Pandas DataFrame
|
||||
df = pd.read_csv(file_path, sep='\t')
|
||||
|
||||
# Inspect the DataFrame
|
||||
print("First rows of the DataFrame:")
|
||||
print(df.head(10))
|
||||
|
||||
# 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)
|
||||
Reference in New Issue
Block a user