Participação de mulheres em posições de destaque no cinema

Dados

Os dados utilizados possuem metadados para 45.000 filmes listados no dataset MovieLens até Julho de 2017. Esses metadados incluem título, descrição, ano de lançamento, gêneros, classificação, equipe de produção, elenco, link para o IMDB e TMDB, entre outros dados.

movies_metadata.csv: O principal arquivo de metadados de filmes. Contém informações sobre 45.000 filmes apresentados no conjunto de dados Full MovieLens. Os recursos incluem pôsteres, cenários, orçamento, receitas, datas de lançamento, idiomas, países de produção e empresas.

keywords.csv: Contém as palavras-chave do enredo do filme para nossos filmes MovieLens. Disponível na forma de um objeto JSON stringificado.

credits.csv: Consiste em informações do elenco e da equipe de todos os nossos filmes. Disponível na forma de um objeto JSON stringificado.

links.csv: o arquivo que contém os IDs TMDB e IMDB de todos os filmes apresentados no conjunto de dados Full MovieLens.

links_small.csv: contém os IDs TMDB e IMDB de um pequeno subconjunto de 9.000 filmes do conjunto de dados completo.

ratings_small.csv: o subconjunto de 100.000 avaliações de 700 usuários em 9.000 filmes.

Preparação dos dados

Carregar os dados que vamos utilizar na análise

movie_metadata <- read.csv("./movies_metadata.csv")
credits <- read.csv("./credits.csv")

Tratamento dos dados da equipe

Os dados do dataset contendo a produção e o elenco estava num formato pensado no consumo por python, e não por outras linguagens. O CSV possui 3 colunas: * A primeira possui o Identificador do filme * A segunda um dicionário com todo o elenco * a terceira um dicionário com toda a equipe de produção

Como não é possível ler esse formato com o R de forma nativa, precisamos escrever um script em python para converter num formato intermediário para prosseguir com a análise.

Como um dicionário em python é mateado num JSON, primeiro fizemos essa conversão lendo o arquivo credits.csv e salvando o arquivo convertido para JSON como credits_converted.csv

import csv
import pandas as pd
import json
import numpy as np
import ast

credits = pd.read_csv('./credits.csv')

crew = []
cast = []
id = []

for i in credits.index:
  crew.append(json.dumps(ast.literal_eval(credits['crew'][i])))
  cast.append(json.dumps(ast.literal_eval(credits['cast'][i])))
  id.append(credits['id'][i])

d = {'id': id, 'cast':cast, 'crew':crew}
df = pd.DataFrame(data=d)

df.to_csv('./credits_converted.csv')

Carregar dados dos créditos

Com os dados convertidos foi possível importar e converter do formato JSON para um dataframe com os valores da equipe crew_df

Depois disso, fizemos a leitura do JSON e transformamos cada célula de um filme em múltiplas linhas, cada uma com a informação de uma pessoa da equipe.

credits = read.csv('./credits_converted.csv')

crew_df <- data.frame()

for (row in 1:nrow(credits)) {
  df <- fromJSON(credits[row, "crew"])
  df$movie_id <- credits[row, "id"]
  crew_df <- bind_rows(crew_df, df)
}

head(crew_df)
##                  credit_id department gender    id        job           name
## 1 52fe4284c3a36847f8024f49  Directing      2  7879   Director  John Lasseter
## 2 52fe4284c3a36847f8024f4f    Writing      2 12891 Screenplay    Joss Whedon
## 3 52fe4284c3a36847f8024f55    Writing      2     7 Screenplay Andrew Stanton
## 4 52fe4284c3a36847f8024f5b    Writing      2 12892 Screenplay     Joel Cohen
## 5 52fe4284c3a36847f8024f61    Writing      0 12893 Screenplay   Alec Sokolow
## 6 52fe4284c3a36847f8024f67 Production      1 12894   Producer  Bonnie Arnold
##                       profile_path movie_id
## 1 /7EdqiNbr4FRjIhKHyPPdFfEEEFG.jpg      862
## 2 /dTiVsuaTVTeGmvkhcyJvKp2A5kr.jpg      862
## 3 /pvQWsu0qc8JFQhMVJkTHuexUAa1.jpg      862
## 4 /dAubAiZcvKFbboWlj7oXOkZnTSu.jpg      862
## 5 /v79vlRYi94BZUQnkkyznbGUZLjT.jpg      862
## 6                             <NA>      862

Análise dos dados

Separação por papeis na produção

Para fazer a análise da participação das mulheres por papeis, primeiro vamos fazer a divisão pelos papeis.

Para nossa análise, escolhemos Direção, Roteiro e Produção como os papeis de destaque.

directors <- crew_df[crew_df$job == "Director",]
writers <- crew_df[crew_df$job == "Writer",]
producers <- crew_df[crew_df$job == "Producer",]

men_dir <- nrow(directors[directors$gender == 2,])
women_dir <- nrow(directors[directors$gender == 1,])
undefined_dir <- nrow(directors[directors$gender == 0,])

Aqui temos um número considerável de pessoas com o gênero que não foi informado.

Algo para testar no futuro é a aplicação de uma biblioteca para classificar o genero pelo nome e deminuir essa incerteza.

Por enquanto, vamos usar apenas a classificação entre as pessoas com os gêneros definidos

Então vamos ver o número de pessoas do sexo masculino vs do sexo feminino no papel de destaque.

gender_defined <- directors %>% filter(gender != 0)
gender_data <- gender_defined %>% group_by(gender) %>% count(gender)

p1 <- plot_ly(
  x = c("Feminino", "Masculino"),
  y = gender_data$n / nrow(gender_defined),
  ylab= "Percentage",
  name = "Direção",
  type = "bar"
)

gender_defined <- writers %>% filter(gender != 0)
gender_data <- gender_defined %>% group_by(gender) %>% count(gender)

p2 <- plot_ly(
  x = c("Feminino", "Masculino"),
  y = gender_data$n / nrow(gender_defined),
  ylab= "Percentage",
  name = "Roteiro",
  type = "bar"
)

gender_defined <- producers %>% filter(gender != 0)
gender_data <- gender_defined %>% group_by(gender) %>% count(gender)

p3 <- plot_ly(
  x = c("Feminino", "Masculino"),
  y = gender_data$n / nrow(gender_defined),
  ylab= "Percentage",
  name = "Produção",
  type = "bar"
)

subplot(p1,p2,p3)
## Warning: 'bar' objects don't have these attributes: 'ylab'
## Valid attributes include:
## '_deprecated', 'alignmentgroup', 'base', 'basesrc', 'cliponaxis', 'constraintext', 'customdata', 'customdatasrc', 'dx', 'dy', 'error_x', 'error_y', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'insidetextanchor', 'insidetextfont', 'legendgroup', 'legendgrouptitle', 'legendrank', 'marker', 'meta', 'metasrc', 'name', 'offset', 'offsetgroup', 'offsetsrc', 'opacity', 'orientation', 'outsidetextfont', 'selected', 'selectedpoints', 'showlegend', 'stream', 'text', 'textangle', 'textfont', 'textposition', 'textpositionsrc', 'textsrc', 'texttemplate', 'texttemplatesrc', 'transforms', 'type', 'uid', 'uirevision', 'unselected', 'visible', 'width', 'widthsrc', 'x', 'x0', 'xaxis', 'xcalendar', 'xhoverformat', 'xperiod', 'xperiod0', 'xperiodalignment', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'yhoverformat', 'yperiod', 'yperiod0', 'yperiodalignment', 'ysrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'

## Warning: 'bar' objects don't have these attributes: 'ylab'
## Valid attributes include:
## '_deprecated', 'alignmentgroup', 'base', 'basesrc', 'cliponaxis', 'constraintext', 'customdata', 'customdatasrc', 'dx', 'dy', 'error_x', 'error_y', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'insidetextanchor', 'insidetextfont', 'legendgroup', 'legendgrouptitle', 'legendrank', 'marker', 'meta', 'metasrc', 'name', 'offset', 'offsetgroup', 'offsetsrc', 'opacity', 'orientation', 'outsidetextfont', 'selected', 'selectedpoints', 'showlegend', 'stream', 'text', 'textangle', 'textfont', 'textposition', 'textpositionsrc', 'textsrc', 'texttemplate', 'texttemplatesrc', 'transforms', 'type', 'uid', 'uirevision', 'unselected', 'visible', 'width', 'widthsrc', 'x', 'x0', 'xaxis', 'xcalendar', 'xhoverformat', 'xperiod', 'xperiod0', 'xperiodalignment', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'yhoverformat', 'yperiod', 'yperiod0', 'yperiodalignment', 'ysrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'

## Warning: 'bar' objects don't have these attributes: 'ylab'
## Valid attributes include:
## '_deprecated', 'alignmentgroup', 'base', 'basesrc', 'cliponaxis', 'constraintext', 'customdata', 'customdatasrc', 'dx', 'dy', 'error_x', 'error_y', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'insidetextanchor', 'insidetextfont', 'legendgroup', 'legendgrouptitle', 'legendrank', 'marker', 'meta', 'metasrc', 'name', 'offset', 'offsetgroup', 'offsetsrc', 'opacity', 'orientation', 'outsidetextfont', 'selected', 'selectedpoints', 'showlegend', 'stream', 'text', 'textangle', 'textfont', 'textposition', 'textpositionsrc', 'textsrc', 'texttemplate', 'texttemplatesrc', 'transforms', 'type', 'uid', 'uirevision', 'unselected', 'visible', 'width', 'widthsrc', 'x', 'x0', 'xaxis', 'xcalendar', 'xhoverformat', 'xperiod', 'xperiod0', 'xperiodalignment', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'yhoverformat', 'yperiod', 'yperiod0', 'yperiodalignment', 'ysrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'

## Warning: 'bar' objects don't have these attributes: 'ylab'
## Valid attributes include:
## '_deprecated', 'alignmentgroup', 'base', 'basesrc', 'cliponaxis', 'constraintext', 'customdata', 'customdatasrc', 'dx', 'dy', 'error_x', 'error_y', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'insidetextanchor', 'insidetextfont', 'legendgroup', 'legendgrouptitle', 'legendrank', 'marker', 'meta', 'metasrc', 'name', 'offset', 'offsetgroup', 'offsetsrc', 'opacity', 'orientation', 'outsidetextfont', 'selected', 'selectedpoints', 'showlegend', 'stream', 'text', 'textangle', 'textfont', 'textposition', 'textpositionsrc', 'textsrc', 'texttemplate', 'texttemplatesrc', 'transforms', 'type', 'uid', 'uirevision', 'unselected', 'visible', 'width', 'widthsrc', 'x', 'x0', 'xaxis', 'xcalendar', 'xhoverformat', 'xperiod', 'xperiod0', 'xperiodalignment', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'yhoverformat', 'yperiod', 'yperiod0', 'yperiodalignment', 'ysrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'

## Warning: 'bar' objects don't have these attributes: 'ylab'
## Valid attributes include:
## '_deprecated', 'alignmentgroup', 'base', 'basesrc', 'cliponaxis', 'constraintext', 'customdata', 'customdatasrc', 'dx', 'dy', 'error_x', 'error_y', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'insidetextanchor', 'insidetextfont', 'legendgroup', 'legendgrouptitle', 'legendrank', 'marker', 'meta', 'metasrc', 'name', 'offset', 'offsetgroup', 'offsetsrc', 'opacity', 'orientation', 'outsidetextfont', 'selected', 'selectedpoints', 'showlegend', 'stream', 'text', 'textangle', 'textfont', 'textposition', 'textpositionsrc', 'textsrc', 'texttemplate', 'texttemplatesrc', 'transforms', 'type', 'uid', 'uirevision', 'unselected', 'visible', 'width', 'widthsrc', 'x', 'x0', 'xaxis', 'xcalendar', 'xhoverformat', 'xperiod', 'xperiod0', 'xperiodalignment', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'yhoverformat', 'yperiod', 'yperiod0', 'yperiodalignment', 'ysrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'

## Warning: 'bar' objects don't have these attributes: 'ylab'
## Valid attributes include:
## '_deprecated', 'alignmentgroup', 'base', 'basesrc', 'cliponaxis', 'constraintext', 'customdata', 'customdatasrc', 'dx', 'dy', 'error_x', 'error_y', 'hoverinfo', 'hoverinfosrc', 'hoverlabel', 'hovertemplate', 'hovertemplatesrc', 'hovertext', 'hovertextsrc', 'ids', 'idssrc', 'insidetextanchor', 'insidetextfont', 'legendgroup', 'legendgrouptitle', 'legendrank', 'marker', 'meta', 'metasrc', 'name', 'offset', 'offsetgroup', 'offsetsrc', 'opacity', 'orientation', 'outsidetextfont', 'selected', 'selectedpoints', 'showlegend', 'stream', 'text', 'textangle', 'textfont', 'textposition', 'textpositionsrc', 'textsrc', 'texttemplate', 'texttemplatesrc', 'transforms', 'type', 'uid', 'uirevision', 'unselected', 'visible', 'width', 'widthsrc', 'x', 'x0', 'xaxis', 'xcalendar', 'xhoverformat', 'xperiod', 'xperiod0', 'xperiodalignment', 'xsrc', 'y', 'y0', 'yaxis', 'ycalendar', 'yhoverformat', 'yperiod', 'yperiod0', 'yperiodalignment', 'ysrc', 'key', 'set', 'frame', 'transforms', '_isNestedKey', '_isSimpleKey', '_isGraticule', '_bbox'

Agora que temos uma noção da discrepância de gênero, vamos avaliar como foi a evoução da participação de pessoas do sexo feminino em posições de maior destaque com o tempo

filtered_crew <- crew_df %>% filter(gender != 0) %>% filter(job %in% c("Director", "Writer", "Producer"))
crew_by_movie <- merge(filtered_crew, movie_metadata, by.x = "movie_id", by.y = "id", all = T)
crew_by_movie <- crew_by_movie[!duplicated(crew_by_movie),]

head(crew_by_movie)
##   movie_id                credit_id department gender    id      job
## 1      100 52fe4217c3a36847f80035c1  Directing      2   956 Director
## 2      100 52fe4217c3a36847f80035c7 Production      2   957 Producer
## 3    10000 537525750e0a263031000299  Directing      2 61710 Director
## 4    10000 537527c2c3a3681ecd000185    Writing      2 61711   Writer
## 5    10000 53752989c3a3681ee10001f9 Production      2 61710 Producer
## 6    10001 52fe43039251416c75000035  Directing      2 61797 Director
##               name                     profile_path adult belongs_to_collection
## 1      Guy Ritchie /uLpiixgcko2W5GLsqBEvSfluyEs.jpg False                      
## 2   Matthew Vaughn  /Dnbz3B7yy4u0abixuD5LakZgsy.jpg False                      
## 3   Sergio Cabrera /3RsA3N2riu5MeTtuOm5j5swWYOo.jpg False                      
## 4 Jorge Goldenberg                             <NA> False                      
## 5   Sergio Cabrera /3RsA3N2riu5MeTtuOm5j5swWYOo.jpg False                      
## 6    Yahoo Serious /pe2eKvE4PpdMhmNCIylDjoQhg2o.jpg False                      
##    budget
## 1 1350000
## 2 1350000
## 3       0
## 4       0
## 5       0
## 6       0
##                                                                   genres
## 1            [{'id': 35, 'name': 'Comedy'}, {'id': 80, 'name': 'Crime'}]
## 2            [{'id': 35, 'name': 'Comedy'}, {'id': 80, 'name': 'Crime'}]
## 3            [{'id': 35, 'name': 'Comedy'}, {'id': 18, 'name': 'Drama'}]
## 4            [{'id': 35, 'name': 'Comedy'}, {'id': 18, 'name': 'Drama'}]
## 5            [{'id': 35, 'name': 'Comedy'}, {'id': 18, 'name': 'Drama'}]
## 6 [{'id': 35, 'name': 'Comedy'}, {'id': 878, 'name': 'Science Fiction'}]
##                                                                           homepage
## 1 http://www.universalstudiosentertainment.com/lock-stock-and-two-smoking-barrels/
## 2 http://www.universalstudiosentertainment.com/lock-stock-and-two-smoking-barrels/
## 3                                                                                 
## 4                                                                                 
## 5                                                                                 
## 6                                                                                 
##     imdb_id original_language                      original_title
## 1 tt0120735                en Lock, Stock and Two Smoking Barrels
## 2 tt0120735                en Lock, Stock and Two Smoking Barrels
## 3 tt0109747                es           La estrategia del caracol
## 4 tt0109747                es           La estrategia del caracol
## 5 tt0109747                es           La estrategia del caracol
## 6 tt0096486                en                      Young Einstein
##                                                                                                                                                                                                                                                                                                                                                       overview
## 1                                                                                                                     A card sharp and his unwillingly-enlisted friends need to make a lot of cash quick after losing a sketchy poker match. To do this they decide to pull a heist on a small-time gang who happen to be operating out of the flat next door.
## 2                                                                                                                     A card sharp and his unwillingly-enlisted friends need to make a lot of cash quick after losing a sketchy poker match. To do this they decide to pull a heist on a small-time gang who happen to be operating out of the flat next door.
## 3             A group of tenants living in an old house are confronted with having to move out due to a renovation project the city has undertaken. The tenants decide to unite and come up with a strategy, but in the process—while the landlord and his aggressive attorney are chasing them—the tenants transform into the opposite of who they once were.
## 4             A group of tenants living in an old house are confronted with having to move out due to a renovation project the city has undertaken. The tenants decide to unite and come up with a strategy, but in the process—while the landlord and his aggressive attorney are chasing them—the tenants transform into the opposite of who they once were.
## 5             A group of tenants living in an old house are confronted with having to move out due to a renovation project the city has undertaken. The tenants decide to unite and come up with a strategy, but in the process—while the landlord and his aggressive attorney are chasing them—the tenants transform into the opposite of who they once were.
## 6 Albert Einstein is the son of a Tasmanian apple farmer, who discovers the secret of splitting the beer atom to put the bubbles back into beer. When Albert travels to Sydney to patent his invention he meets beatuiful French scientist Marie Curie, as well as several unscrupulous types who try to take advantage of the naive genius and his invention.
##   popularity                      poster_path
## 1    4.60786 /qV7QaSf7f7yC2lc985zfyOJIAIN.jpg
## 2    4.60786 /qV7QaSf7f7yC2lc985zfyOJIAIN.jpg
## 3   0.281609 /mdfFmAd1dXPa02GvZTnGDPWLut6.jpg
## 4   0.281609 /mdfFmAd1dXPa02GvZTnGDPWLut6.jpg
## 5   0.281609 /mdfFmAd1dXPa02GvZTnGDPWLut6.jpg
## 6   2.562888  /5urimrfyzWmpcZErQ0jH4uLHdd.jpg
##                                                                                                                                                                                                                     production_companies
## 1 [{'name': 'Handmade Films Ltd.', 'id': 146}, {'name': 'Summit Entertainment', 'id': 491}, {'name': 'PolyGram Filmed Entertainment', 'id': 1382}, {'name': 'SKA Films', 'id': 13419}, {'name': 'The Steve Tisch Company', 'id': 21920}]
## 2 [{'name': 'Handmade Films Ltd.', 'id': 146}, {'name': 'Summit Entertainment', 'id': 491}, {'name': 'PolyGram Filmed Entertainment', 'id': 1382}, {'name': 'SKA Films', 'id': 13419}, {'name': 'The Steve Tisch Company', 'id': 21920}]
## 3                                                                                                     [{'name': 'Ministère de la Culture et de la Francophonie', 'id': 2587}, {'name': 'Ministère des Affaires Étrangères', 'id': 2588}]
## 4                                                                                                     [{'name': 'Ministère de la Culture et de la Francophonie', 'id': 2587}, {'name': 'Ministère des Affaires Étrangères', 'id': 2588}]
## 5                                                                                                     [{'name': 'Ministère de la Culture et de la Francophonie', 'id': 2587}, {'name': 'Ministère des Affaires Étrangères', 'id': 2588}]
## 6                                                                                                                                                                                                 [{'name': 'Warner Bros.', 'id': 6194}]
##                                                                                                        production_countries
## 1                                                                          [{'iso_3166_1': 'GB', 'name': 'United Kingdom'}]
## 2                                                                          [{'iso_3166_1': 'GB', 'name': 'United Kingdom'}]
## 3 [{'iso_3166_1': 'CO', 'name': 'Colombia'}, {'iso_3166_1': 'FR', 'name': 'France'}, {'iso_3166_1': 'IT', 'name': 'Italy'}]
## 4 [{'iso_3166_1': 'CO', 'name': 'Colombia'}, {'iso_3166_1': 'FR', 'name': 'France'}, {'iso_3166_1': 'IT', 'name': 'Italy'}]
## 5 [{'iso_3166_1': 'CO', 'name': 'Colombia'}, {'iso_3166_1': 'FR', 'name': 'France'}, {'iso_3166_1': 'IT', 'name': 'Italy'}]
## 6                                                                               [{'iso_3166_1': 'AU', 'name': 'Australia'}]
##   release_date revenue runtime                         spoken_languages
## 1   1998-03-05 3897569     105 [{'iso_639_1': 'en', 'name': 'English'}]
## 2   1998-03-05 3897569     105 [{'iso_639_1': 'en', 'name': 'English'}]
## 3   1993-12-25       0     116 [{'iso_639_1': 'es', 'name': 'Español'}]
## 4   1993-12-25       0     116 [{'iso_639_1': 'es', 'name': 'Español'}]
## 5   1993-12-25       0     116 [{'iso_639_1': 'es', 'name': 'Español'}]
## 6   1988-12-15       0      91 [{'iso_639_1': 'en', 'name': 'English'}]
##     status                             tagline
## 1 Released A Disgrace to Criminals Everywhere.
## 2 Released A Disgrace to Criminals Everywhere.
## 3 Released                                    
## 4 Released                                    
## 5 Released                                    
## 6 Released                               E=mc²
##                                 title video vote_average vote_count
## 1 Lock, Stock and Two Smoking Barrels False          7.5       1671
## 2 Lock, Stock and Two Smoking Barrels False          7.5       1671
## 3           La estrategia del caracol False          7.2          9
## 4           La estrategia del caracol False          7.2          9
## 5           La estrategia del caracol False          7.2          9
## 6                      Young Einstein False          4.5         46

Agora vamos montar os gráficos

crew_by_movie$year <- str_extract(crew_by_movie[,"release_date"], "^[0-9]{4}")

crew_by_movie$gender[crew_by_movie$gender == 1] <- "Female"
crew_by_movie$gender[crew_by_movie$gender == 2] <- "Male"

directors <- crew_by_movie[crew_by_movie$job == "Director",]
writers <- crew_by_movie[crew_by_movie$job == "Writer",]
producers <- crew_by_movie[crew_by_movie$job == "Producer",]

gender_defined <- directors %>% filter(gender != 0) 
gender_data <- gender_defined %>% group_by(year, gender) %>% count(year, gender) %>% arrange(year)

plot_data <- gender_data %>% spread(gender, n)
plot_data[,2:3] <- replace(plot_data[2:3], is.na(plot_data[2:3]), 0)

plot_data$woman_perc <- (plot_data$Female / (plot_data$Female + plot_data$Male)) * 100
plot_data$man_perc <- (plot_data$Male / (plot_data$Female + plot_data$Male)) * 100

p1 <- plot_ly(
  data = plot_data,
  x = ~year,
  y = ~woman_perc,
  name= "Mulheres",
  type="bar"
)
p1 <- p1 %>% add_trace(y = ~man_perc, name="Homens")
p1 %>% layout(
  xaxis= list(title="Ano"),
  yaxis=list(title="Porcentagem"),
  title="Participação de gênero na Direção de cinema por ano",
  legend=list(title=list(text="<b>Gênero</b>"))
)
## Warning: Ignoring 1 observations

## Warning: Ignoring 1 observations
gender_defined <- writers %>% filter(gender != 0) 
gender_data <- gender_defined %>% group_by(year, gender) %>% count(year, gender) %>% arrange(year)

plot_data <- gender_data %>% spread(gender, n)
plot_data[,2:3] <- replace(plot_data[2:3], is.na(plot_data[2:3]), 0)

plot_data$woman_perc <- (plot_data$Female / (plot_data$Female + plot_data$Male)) * 100
plot_data$man_perc <- (plot_data$Male / (plot_data$Female + plot_data$Male)) * 100

p2 <- plot_ly(
  data = plot_data,
  x = ~year,
  y = ~woman_perc,
  name= "Mulheres",
  type="bar"
)
p2 <- p2 %>% add_trace(y = ~man_perc, name="Homens")
p2%>% layout(
  xaxis= list(title="Ano"),
  yaxis=list(title="Porcentagem"),
  title="Participação de gênero no Roteiro de cinema por ano",
  legend=list(title=list(text="<b>Gênero</b>"))
)
## Warning: Ignoring 1 observations

## Warning: Ignoring 1 observations
gender_defined <- producers %>% filter(gender != 0) 
gender_data <- gender_defined %>% group_by(year, gender) %>% count(year, gender) %>% arrange(year)

plot_data <- gender_data %>% spread(gender, n)
plot_data[,2:3] <- replace(plot_data[2:3], is.na(plot_data[2:3]), 0)

plot_data$woman_perc <- (plot_data$Female / (plot_data$Female + plot_data$Male)) * 100
plot_data$man_perc <- (plot_data$Male / (plot_data$Female + plot_data$Male)) * 100

p3 <- plot_ly(
  data = plot_data,
  x = ~year,
  y = ~woman_perc,
  name= "Mulheres",
  type="bar"
)
p3 <- p3 %>% add_trace(y = ~man_perc, name="Homens")
p3 %>% layout(
  xaxis= list(title="Ano"),
  yaxis=list(title="Porcentagem"),
  title="Participação de gênero na Produção de cinema por ano",
  legend=list(title=list(text="<b>Gênero</b>"))
)
## Warning: Ignoring 1 observations

## Warning: Ignoring 1 observations

Conclusões

Apesar do aumento da participação de mulheres em posições de destaque no cinema, esse progresso ainda é muito pequeno. De acordo com os gráficos apresentados conseguimos ver que ainda há um longo caminho a percorrer para alcançar a igualdade de gênero na indústria cinematográfica.

Existem algumas razões para essa desigualdade. Uma delas é a falta de oportunidades para as mulheres. Elas são menos frequentemente contratadas para cargos de direção, roteiro e produção, e também recebem menos salário do que seus colegas homens. Outra razão é a discriminação. As mulheres ainda enfrentam barreiras no cinema, como o assédio sexual e a falta de apoio.

É preciso tomar medidas para aumentar a participação de mulheres em posições de destaque no cinema. Isso inclui ações de conscientização, programas de treinamento e mudanças nas políticas das empresas. Com mais oportunidades e apoio, as mulheres podem contribuir ainda mais para a indústria cinematográfica e criar um setor mais diverso e inclusivo.