# Python 3 # File: Assignment2_Exercise1_read_data.py # For Computational Statistics class, Fall 2026 # Authors: Jonathan Goodman, goodman@cims.nyu.edu # class web site: https://math.nyu.edu/~goodman/teaching/ComputationalStatistics2026/ComputationalStatistics.html """ Read a pandas dataframe in parquet format and do a simple computation with it. To be modified for Exercise 1 of assignment 2 """ import numpy as np # load the nympy library, call it np import matplotlib.pyplot as plt # the plotting package import pandas as pd # the pandas library filename = "Assignment2_Exercise1_dataset1.parquet" def log_r(x, # the data value nu = 3., # the number of degrees of freedom r = .5 # the lengthscale ): # return log( r(x, params) ), see notes for definition return x*x # replace with correct function # read into a pandas dataframe df = pd.read_parquet(filename) # read into a pandas dataframe # calculate log(r(x)) for each x in the dataset log_like_terms = df["X_k"].map(log_r) # calculate log(r(x)) log_likelihood_sum = log_like_terms.sum() # add the numbers, for no reason print("the log likelihood sum is " + str(log_likelihood) )