Wolfram Media -- The Publishing Unit of the Wolfram Group

Query: Getting Information from Data with the Wolfram Language

Mathematica and the Wolfram Language provide an integrated environment for sophisticated programming, making them the ideal tools for calculus, data visualization, machine learning, and more. But how about using Wolfram as the linchpin for organizing data? In this book, Professor Seth J. Chandler, an award-winning, 30-year user of the Wolfram Language, guides intermediate users from simple cases to data in the wild and shows how each can be fed into the full range of Wolfram Language functionality. It's both a conceptual and practical approach filled with annotated examples.

Want to know more about associations or the organization and presentation of datasets? This book shows how it's done. Want to organize or reduce data in the Wolfram Language similarly to the way one might use SQL, pandas in Python, or dplyr in R's tidyverse? This book shows how to simplify data processing and go beyond what is possible with other tools using the Query function. It also explores how to import information from the places real-world data is most likely to be found: CSV, Excel, or JSON files.

Use Query both as a tutorial and as a reference. Read it cover-to-cover doing the exercises or dip in to look up specific data-wrangling tasks. Augmenting the underlying power of the Wolfram Language with the techniques taught in this book puts you at the forefront of innovative data analysis.

Buy from Amazon Buy from Barnes & Noble Buy from Wolfram Read Online

Information and Media Inquiries

October 3, 2023 Publication
Publicity and Interviews: publishing@wolfram.com
Trim Size: 7" x 10"

Distribution by Ingram, Amazon and Baker & Taylor

UK Distribution: Turnaround Publisher Services


  • Introduction
  • Purpose · Audience · How to Read This Book · Chapter Roadmap · Version · Front End · Repositories · Conventions · Exercises · Technical Notes · A Little about Me
  • Data Structures and Functions
  • The Mathematica Expression · The Part Function · The Function · The List · Levels · Position: Part and Level · Functional Programming Constructs · Common Operations on Lists · A Sample Problem Using “Old-School” Wolfram Language Methods · Conclusion
  • Association
  • A Home-Brewed Indexed Data Structure · The Association · Using Part with Association · Functions on Associations · Associations inside Other Expressions · Position on Association · KeyTake and KeyDrop · Lookup · Building Associations · Functional Programming Constructs Used on Associations · Apply and Transpose · KeyMap · KeyValueMap · The KeyReplace Resource Function · Select · GatherBy · GroupBy · Associations as Functions · Putting It Together: More Complex Operations Using Operators and Composition
  • Query
  • Query Structure · Order of Operations in Query · Four Complications · Solve Sample Problems with Query · How to Do Nothing: All or Identity · Queries with Deeply Nested Datasets · Functions That Create Queries · Debugging Queries That Go Wrong
  • The Dataset
  • Introduction · Inside the Datasets · Dataset Presentation
  • Basic Recipes
  • Introduction · Get the Dimensions of a Dataset · Rename All of the Columns · Rename Just Some of the Columns · Sort Rows and Columns · Sort Groupings · Sample the Rows · Replace Some Key-Value Pairs in an Association: The Association Override Feature · Keep and Drop Rows or Columns · Join Columns Based on Precomputed Data · Join a Column to a Dataset Based on Values in the Existing Columns · Change the Value of an Existing Column: Row-Wise · Add Row Headers (Indexing) · Delete Row Headers · Turn Row Headers into Columns · Give a Column Orientation to a Dataset · Give a Row Orientation to a Dataset · Transpose Datasets and the Double Transpose Trick · Defer Operation of a Descending Operator
  • Advanced Recipes
  • Introduction · Recipe 1: Use Column Aggregates to Derive New Columns · Recipe 2: Aggregate Single Measures by Group · Recipe 3: Make the Keys in Each Row of Data Identical · Recipe 4: Create Multiple Aggregate Measures of Grouped Data · Recipe 5: “Cross Tabulate” Data · Recipe 6: Get Row and/or Column Aggregates of Data · Recipe 7: Prepare Data for Statistical Analysis Functions · Recipe 8: Prepare Data for Machine Learning Functions · Recipe 9: Combine Graphics with Query · Recipe 10: Retrieve Information from the Wolfram Data Repository · Recipe 11: Flatten Hierarchy in a Dataset or Convert One Dataset into Multiple Related Datasets · Recipe 12: Create Overlapping Sets of Data
  • Import and Export
  • Introduction · The "Format" and "Elements" Concept · Using the WXF Format · Using the Text Export Format · Using the CSV Export Format · Using the Excel (XLS, XLSX) Format · Using the JSON Format · Using the ZIP Format · Using the Google Sheets Format
  • Answers to Exercises
  • Index

About the Author

Seth J. Chandler is a Law Foundation Professor of Law at the University of Houston Law Center (UHLC). He maintains a dual life as a law professor, teaching subjects such as constitutional law and insurance law, and as an expert on the Wolfram Language, presenting at numerous Wolfram conferences and winning a Wolfram Innovator Award in 2011. He has combined both of his passions in the course Analytic Methods for Lawyers, which is taught at UHLC and is available via his YouTube channel (@sethjchandler). He has made many contributions to the Wolfram Demonstrations Project, Function Repository, and Data Repository and to Wolfram Community. Professor Chandler received his undergraduate degree in 1979 from Princeton University and his Juris Doctorate in 1983 from Harvard Law School, where he served as Managing Editor of the Harvard Law Review. His knowledge of math and of the Wolfram Language is generally self-taught, much of it from listening to and reading the works of Stephen Wolfram and others. He has never taken a college-level programming course; the last math course on his transcript is a linear algebra class from 1975.

  • Author: Seth J. Chandler
  • Paperback: $39.95   368 pages
  • eBook: $24.95   368 pages
  • Publisher: Wolfram Media, Inc.
  • Publication Date: October 3, 2023
  • ISBN-13: 978-1-57955-085-1 (paperback)
  • ISBN-13: 978-1-57955-086-8 (eBook)