Tables.jl Compatibility
Giac.jl provides full Tables.jl compatibility, enabling seamless integration with the Julia data ecosystem including DataFrames.jl and CSV.jl.
GiacMatrix to DataFrame
Convert symbolic matrices to DataFrames for analysis and export:
using Giac
using DataFrames
# Create a numeric matrix
m = GiacMatrix([1 2 3; 4 5 6])
# Convert to DataFrame
df = DataFrame(m)
# 2×3 DataFrame
# Row │ col1 col2 col3
# │ String String String
# ─────┼────────────────────────
# 1 │ 1 2 3
# 2 │ 4 5 6Symbolic Matrices
Symbolic values are converted to strings:
@giac_var x y
m = GiacMatrix([x y; x+1 y+1])
df = DataFrame(m)
# 2×2 DataFrame
# Row │ col1 col2
# │ String String
# ─────┼────────────────
# 1 │ x y
# 2 │ x+1 y+1Row and Column Access
Access data using the Tables.jl interface:
# Row iteration
for row in Tables.rows(m)
println(Tables.getcolumn(row, :col1))
end
# Column access
cols = Tables.columns(m)
first_col = Tables.getcolumn(cols, :col1) # Vector of valuesCSV Export
Export matrices directly to CSV files:
using CSV
m = GiacMatrix(giac_eval("[[1,2,3],[4,5,6]]"))
CSV.write("matrix.csv", m)Command Help as Tables
Single Command Help
Convert help information for a single command to a table:
using Giac
using DataFrames
hr = Giac.help(:factor) # Returns structured HelpResult (unexported; for raw text use giac_help(:factor))
df = DataFrame(hr)
# 1×5 DataFrame
# Row │ command category description related examples
# │ String String String String String
# ─────┼──────────────────────────────────────────────────────────────
# 1 │ factor algebra ... ifactor, partfrac ...For interactive help, use Julia's native help system:
using Giac.Commands: factor
?factor # Shows GIAC documentation in REPLAll Commands Table
Get a table of all ~2000 GIAC commands with documentation:
using DataFrames
ct = commands_table()
df = DataFrame(ct)
# ~2000×5 DataFrame with columns:
# - command: Command name
# - category: Category (algebra, calculus, etc.)
# - description: Command description
# - related: Related commands (comma-separated)
# - examples: Usage examples (semicolon-separated)Filtering Commands
Use DataFrame operations to filter and search commands:
using DataFrames
df = DataFrame(commands_table())
# Find all algebra commands
algebra_cmds = filter(row -> row.category == "algebra", df)
# Search by description
factor_cmds = filter(row -> occursin("factor", lowercase(row.description)), df)Caching
The commands table is cached for performance. To refresh:
clear_commands_cache!()
ct = commands_table() # Fresh collectionTable of Functions
| Function | Description |
|---|---|
Tables.istable(GiacMatrix) | Returns true |
Tables.rows(m::GiacMatrix) | Row iterator |
Tables.columns(m::GiacMatrix) | Column accessor |
Tables.schema(m::GiacMatrix) | Column names and types |
Tables.istable(HelpResult) | Returns true |
Tables.rows(hr::HelpResult) | Single-row iterator |
commands_table() | All commands as table |
clear_commands_cache!() | Clear commands cache |
API Reference
Giac.commands_table — Function
commands_table() -> CommandsTableReturn a Tables.jl-compatible collection of all GIAC command help.
Results are cached after the first call for performance. Use clear_commands_cache!() to invalidate the cache.
Example
using DataFrames
# Get all commands as DataFrame
df = DataFrame(commands_table())
# Filter by category
algebra_cmds = filter(row -> row.category == "algebra", df)
# Export to CSV
using CSV
CSV.write("giac_commands.csv", commands_table())See also
clear_commands_cache!: Invalidate the cachegiac_help: Get raw help for a single command
Giac.clear_commands_cache! — Function
clear_commands_cache!()Clear the cached CommandsTable, forcing re-collection on next commands_table() call.
Example
ct1 = commands_table() # Collects all commands
clear_commands_cache!()
ct2 = commands_table() # Re-collects all commandsSee also
commands_table: Get the commands table
Giac.CommandsTable — Type
CommandsTableCached collection of all GIAC command help as Tables.jl source.
Created by commands_table(). Contains pre-collected help information for all available GIAC commands.
Example
using DataFrames
ct = commands_table()
df = DataFrame(ct)
filter(row -> row.category == "algebra", df)