File size: 1,031 Bytes
74bdacd
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import pandas as pd

csv_path = "src/data/yt_data.csv"
UPDATED_CSV_PATH = "src/data/merged_yt_data.csv"
# csv_df = pd.read_csv(csv_path)


def get_updated_df():

    final_csv_df = pd.read_csv(UPDATED_CSV_PATH)
    return final_csv_df


# df = get_updated_df()
# print(df.columns)

# # Load JSON file
# json_path = "category_id.json"
# json_df = pd.read_json(json_path)

# # Extract category ID and title from JSON
# category_df = pd.json_normalize(json_df["items"])
# category_df = category_df[["id", "snippet.title"]].rename(
#     columns={"id": "category_id", "snippet.title": "category_name"})

# # Merge CSV data with category data on category_id
# csv_df["category_id"] = csv_df["category_id"].astype(
#     str)  # Ensure category_id is a string for merging
# merged_df = pd.merge(csv_df, category_df, on="category_id",
#                      how="left")  # Left join to keep all video data


# # Save the merged DataFrame as a new CSV file
# merged_path = "merged_yt_data.csv"
# merged_df.to_csv(merged_path, index=False)