Spaces:
Sleeping

scripti_sandbox / analytics_v02.py
kaurdotai's picture
Beatsbarnch
b23bbe0
Raw History Blame Contribute Delete
1.21 kB
import os
import json
import ast
from huggingface_hub import login
from datasets import load_dataset
# Load the private dataset
dataset = load_dataset("kaurdotai/scripti_feedback", token= True)
# Access the 51st row (index 50)
row_51 = dataset['train'] # Accessing the 'train' split
# Print the data in row 51
# print ((row_51[41]))
item = (row_51[41])
print ((item))
# # Convert the row to a list to access columns by index
# # row_values = list(row_51.values())
# # # # Specify the index of the column you want to access
# # column_index = 2 # Replace with the actual index you want to access (0 for the first column)
# # # # Access the specific column value in row 51
# # column_value = row_values[column_index]
# # # # Print the value of the specified column in row 51
# # print(type(column_value), column_value)
# # Your data as a string
# # Convert the string to a Python object
# data_list = ast.literal_eval(item[1])
# filtered_data = [{"role": item["role"], "content": item["content"]} for item in data_list]
# # # Print the data in pretty JSON format
# print(json.dumps(filtered_data, indent=4))
# # print(json.dumps(column_value, indent=4)) # Print feedback in pretty JSON format