Movies

A large dataset containing movies. There are some unknown columns, but some may potentially be of interest.
MATH221
entertainment
Author

MATH 221

Published

May 2, 2024

Data details

There are 58,788 rows and 24 columns. The data source1 is used to create our data that is stored in our pins table. You can access this pin from a connection to posit.byui.edu using hathawayj/movies.

This data is available to all.

Variable description

  • title Movie title
  • year Release Year
  • length Movie length (min)
  • budget Budget (dollars)
  • rating Rating
  • votes Unkown
  • r1 Unkown
  • r2 Unkown
  • r3 Unkown
  • r4 Unkown
  • r5 Unkown
  • r6 Unkown
  • r7 Unkown
  • r8 Unkown
  • r9 Unkown
  • r10 Unkown
  • mpaa Motion Picture Association of America rating (NC-17, PG, PG-13, R)
  • Action Whether film pertains to action genre or not (0, 1)
  • Animation Whether film pertains to animation genre or not (0, 1)
  • Comedy Whether film pertains to comedy genre or not (0, 1)
  • Drama Whether film pertains to drama genre or not (0, 1)
  • Documentary Whether film pertains to documentary genre or not (0, 1)
  • Romance Whether film pertains to romance genre or not (0, 1)
  • Short Whether film pertains to short genre or not (0, 1)

Variable summary

Variable type: numeric

skim_variable n_missing complete_rate mean sd p0 p25 p50 p75 p100 hist
year 0 1.00 1976.13 23.74 1893 1958.0 1983.0 1.997e+03 2005.0 ▁▁▃▃▇
length 0 1.00 82.34 44.35 1 74.0 90.0 1.000e+02 5220.0 ▇▁▁▁▁
budget 53573 0.09 13412513.25 23350084.93 0 250000.0 3000000.0 1.500e+07 200000000.0 ▇▁▁▁▁
rating 0 1.00 5.93 1.55 1 5.0 6.1 7.000e+00 10.0 ▁▃▇▆▁
votes 0 1.00 632.13 3829.62 5 11.0 30.0 1.120e+02 157608.0 ▇▁▁▁▁
r1 0 1.00 7.01 10.94 0 0.0 4.5 4.500e+00 100.0 ▇▁▁▁▁
r2 0 1.00 4.02 5.96 0 0.0 4.5 4.500e+00 84.5 ▇▁▁▁▁
r3 0 1.00 4.72 6.45 0 0.0 4.5 4.500e+00 84.5 ▇▁▁▁▁
r4 0 1.00 6.37 7.59 0 0.0 4.5 4.500e+00 100.0 ▇▁▁▁▁
r5 0 1.00 9.80 9.73 0 4.5 4.5 1.450e+01 100.0 ▇▁▁▁▁
r6 0 1.00 13.04 10.98 0 4.5 14.5 1.450e+01 84.5 ▇▂▁▁▁
r7 0 1.00 15.55 11.59 0 4.5 14.5 2.450e+01 100.0 ▇▃▁▁▁
r8 0 1.00 13.88 11.32 0 4.5 14.5 2.450e+01 100.0 ▇▃▁▁▁
r9 0 1.00 8.95 9.44 0 4.5 4.5 1.450e+01 100.0 ▇▁▁▁▁
r10 0 1.00 16.85 15.65 0 4.5 14.5 2.450e+01 100.0 ▇▃▁▁▁
Action 0 1.00 0.08 0.27 0 0.0 0.0 0.000e+00 1.0 ▇▁▁▁▁
Animation 0 1.00 0.06 0.24 0 0.0 0.0 0.000e+00 1.0 ▇▁▁▁▁
Comedy 0 1.00 0.29 0.46 0 0.0 0.0 1.000e+00 1.0 ▇▁▁▁▃
Drama 0 1.00 0.37 0.48 0 0.0 0.0 1.000e+00 1.0 ▇▁▁▁▅
Documentary 0 1.00 0.06 0.24 0 0.0 0.0 0.000e+00 1.0 ▇▁▁▁▁
Romance 0 1.00 0.08 0.27 0 0.0 0.0 0.000e+00 1.0 ▇▁▁▁▁
Short 0 1.00 0.16 0.37 0 0.0 0.0 0.000e+00 1.0 ▇▁▁▁▂

Variable type: character

skim_variable n_missing complete_rate min max empty n_unique whitespace
title 0 1.00 1 121 0 56007 0
mpaa 53864 0.08 1 5 0 4 0
Explore generating code using R
library(tidyverse)
library(pins)
library(connectapi)

movies <- read_csv('https://github.com/byuistats/data/raw/master/movies/movies.csv')


# Publish the data to the server with Bro. Hathaway as the owner.
board <- board_connect()
pin_write(board, movies, type = "parquet", access_type = "all")

pin_name <- "movies"
meta <- pin_meta(board, paste0("hathawayj/", pin_name))
client <- connect()
my_app <- content_item(client, meta$local$content_id)
set_vanity_url(my_app, paste0("data/", pin_name))

Access data

This data is available to all.

Direct Download: movies.parquet

R and Python Download:

URL Connections:

For public data, any user can connect and read the data using pins::board_connect_url() in R.

library(pins)
url_data <- "https://posit.byui.edu/data/movies/"
board_url <- board_connect_url(c("dat" = url_data))
dat <- pin_read(board_url, "dat")

Use this custom function in Python to have the data in a Pandas DataFrame.

import pandas as pd
import requests
from io import BytesIO

def read_url_pin(name):
  url = "https://posit.byui.edu/data/" + name + "/" + name + ".parquet"
  response = requests.get(url)
  if response.status_code == 200:
    parquet_content = BytesIO(response.content)
    pandas_dataframe = pd.read_parquet(parquet_content)
    return pandas_dataframe
  else:
    print(f"Failed to retrieve data. Status code: {response.status_code}")
    return None

# Example usage:
pandas_df = read_url_pin("movies")

Authenticated Connection:

Our connect server is https://posit.byui.edu which you assign to your CONNECT_SERVER environment variable. You must create an API key and store it in your environment under CONNECT_API_KEY.

Read more about environment variables and the pins package to understand how these environment variables are stored and accessed in R and Python with pins.

library(pins)
board <- board_connect(auth = "auto")
dat <- pin_read(board, "hathawayj/movies")
import os
from pins import board_rsconnect
from dotenv import load_dotenv
load_dotenv()
API_KEY = os.getenv('CONNECT_API_KEY')
SERVER = os.getenv('CONNECT_SERVER')

board = board_rsconnect(server_url=SERVER, api_key=API_KEY)
dat = board.pin_read("hathawayj/movies")

Footnotes

  1. unknown↩︎