Table of Contents
For when your spreadsheet starts to crawl, but you still need to get the job done.
1. The Basics: Data as a Thing
In Excel, the data and the logic live in the same cell. In Julia, we keep them separate for speed and sanity.
- Workbook/Sheet ≅
DataFrame - Column ≅
:Symbolor"String" - Cell ≅
df[row, col]
| Excel Action | Julia (DataFrames.jl) | Why it’s better |
| Open File | df = CSV.read("data.csv", DataFrame) | Handles millions of rows in seconds. |
| Filter Rows | subset(df, :Status => x -> x .== "Active") | No more "filtering" then copy-pasting to a new sheet. |
| New Column | df.Total = df.Qty .* df.Price | The formula is applied to the whole column instantly. |
| Pivot Table | unstack(df, :RowName, :ColName, :Value) | Reproducible. If the data changes, just re-run the script. |
2. The Big Three Functions
These are the most common Excel idioms translated into the Julia ecosystem.
VLOOKUP / XLOOKUP ↔️leftjoin
In Excel, you look up a value cell-by-cell. In Julia, we "join" the two tables based on a common ID. It’s safer because it prevents "broken" references.
Julia
# Excel: =VLOOKUP(A2, 'Prices'!A:B, 2, FALSE)
combined_df = leftjoin(sales_df, price_list, on = :ProductID)
IF / Nested IF ➡️ ifelse or case
Instead of a nightmare of nested parentheses, Julia uses vectorized logic.
Julia
# Excel: =IF(A2 > 100, "High", "Low")
df.Category = ifelse.(df.Amount .> 100, "High", "Low")
Pivot Tables ➡️groupby & combine
This is where Julia shines. You can summarize data with surgical precision.
Julia
# Create a summary of Total Sales by Region
summary = combine(groupby(df, :Region), :Sales => sum)