This week we’re exploring Brazilian Companies, curated from Brazil’s open CNPJ (Cadastro Nacional da Pessoa Jurídica) records published by the Brazilian Ministry of Finance / Receita Federal on the national open-data portal (dados.gov.br).
The CNPJ open data is a large-scale public registry of Brazilian legal entities. For this dataset, the raw company records were cleaned and enriched with lookup tables (legal nature, owner qualification, and company size), then filtered to retain firms above a share-capital threshold so the analysis focuses on meaningful variation in capital stock.
Which legal nature categories concentrate the highest total and average capital stock?
How does company size relate to capital stock (and how skewed is it)?
Do specific owner qualification groups dominate high-capital companies?
What patterns emerge when comparing the top capital-stock tail across categories (legal nature, size, qualification)?
Thank you to Marcelo Silva for curating this week’s dataset.
# Using Python# Option 1: pydytuesday python library## pip install pydytuesdayimport pydytuesday# Download files from the week, which you can then read in locallypydytuesday.get_date('2026-01-27')# Option 2: Read directly from GitHub and assign to an objectcompanies = pandas.read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-01-27/companies.csv')legal_nature = pandas.read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-01-27/legal_nature.csv')qualifications = pandas.read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-01-27/qualifications.csv')size = pandas.read_csv('https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-01-27/size.csv')
# Using Julia# Option 1: TidierTuesday.jl library## Pkg.add(url="https://github.com/TidierOrg/TidierTuesday.jl")usingTidierTuesday# Download datasets for the week, and load them as a NamedTuple of DataFramesdata =tt_load("2026-01-27")# Option 2: Read directly from GitHub and assign to an object with TidierFilescompanies =read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-01-27/companies.csv")legal_nature =read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-01-27/legal_nature.csv")qualifications =read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-01-27/qualifications.csv")size =read_csv("https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-01-27/size.csv")# Option 3: Read directly from Github and assign without Tidier dependenciescompanies = CSV.read("https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-01-27/companies.csv", DataFrame)legal_nature = CSV.read("https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-01-27/legal_nature.csv", DataFrame)qualifications = CSV.read("https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-01-27/qualifications.csv", DataFrame)size = CSV.read("https://raw.githubusercontent.com/rfordatascience/tidytuesday/main/data/2026/2026-01-27/size.csv", DataFrame)
How to Participate
Explore the data, watching out for interesting relationships. We would like to emphasize that you should not draw conclusions about causation in the data. There are various moderating variables that affect all data, many of which might not have been captured in these datasets. As such, our suggestion is to use the data provided to practice your data tidying and plotting techniques, and to consider for yourself what nuances might underlie these relationships.
Create a visualization, a model, a Quarto report, a shiny app, or some other piece of data-science-related output, using R, Python, or another programming language.
PydyTuesday: A Posit collaboration with TidyTuesday
Exploring the TidyTuesday data in Python? Posit has some extra resources for you! Have you tried making a Quarto dashboard? Find videos and other resources in Posit’s PydyTuesday repo.
Share your work with the world using the hashtags #TidyTuesday and #PydyTuesday so that Posit has the chance to highlight your work, too!
Deploy or share your work however you want! If you’d like a super easy way to publish your work, give Connect Cloud a try.
Data Dictionary
companies.csv
variable
class
description
company_id
integer
Company identifier (8-digit ID used as the primary key in this dataset).
company_name
character
Company legal name (as provided in the source registry).
legal_nature
character
Company legal nature (e.g., “Limited Liability Business Company (LLC)”).