Here's the modified code that saves the extracted data in a dictionary and saves it as a JSON file:

import pandas as pd
import json

Read the externos.csv file into a Pandas DataFrame

df_vra = pd.read_csv('externos.csv', sep=';')

Create an empty dictionary to store the extracted data

data = {}

Loop through each row in the DataFrame

for index, row in df_vra.iterrows():
# Extract the values of the RUT, DV, and Names columns
rut = row["RUT"]
dv = row["DV"]
names = row["Names"]

perl
Copy code
# Add the values to the dictionary
data[index] = {"RUT": rut, "DV": dv, "Names": names}
Save the dictionary as a JSON file

with open('extracted_data.json', 'w') as f:
json.dump(data, f)

This code uses the json library to save the extracted data in a JSON file. The dump method of the json library is used to write the data to the file, which is opened in write mode using the open function.
spam fails_task lang_mismatch pii not_appropriate hate_speech sexual_content quality toxicity humor helpfulness creativity violence