Chapter 13

“So choose your project,” said Dr. Sorenson on the first day of class, “and let me know by next Monday what it is. Needs to require investigation, and you will create software to gather data and produce recommendations. This is called “data science,” and you’ll thank me forever if you decide you like it!”

Now what? thought Celena. I need a project and a programming language!

“Sal, what should I do? I’m not a programmer.”

“Python is easy to learn,” replied the student next to her. “That and ‘R’ are the two big languages in data science, and Python does lots of other stuff besides. Great choice for a math major, and especially one pretending to be an economist.”

OK, then. Python.

And she began looking up ebooks. The Dummy’s Guide to … Learn in 24 hours … Automate the Boring Stuff … that sounds good … a lot of choices!

She settled on “The Python Apprentice”, and marked one about “Python and Data Science” to pick up next.

Looks easier than Java, and more fun than Fortran. This can work. But I need a project.

By the following morning she had settled on predicting stocks, the golden standard of goals that no one expects you to accomplish.


Jennie turned the latch and pushed the glass door open. The fluorescents high above flickered and came on. Celena dropped her bag outside the court, dug out her shoes, and sat down to pull them on.

“Nice court,” said Jennie. “Not all scarred up like the others.”

“Too bad,” called Celena. “I depend on those marks to distract you, or hide the ball. Anything that will help!”

“Not today!” Jennie tossed a hot pink ball against the side wall and stroked a smooth backhand into the corner. “Ah, not today. That felt good.” She caught it, set it up again, and lobbed it to the front of the ceiling.

“Here we go!” said Celena, closing the door behind her and swinging at the ball while it was still shoulder-high. It skipped on the plywood just before the front wall.

“Not percentage racquetball, that shot. Tough to make it work,” said Jennie, as she scooped it up and punched a z-serve into the right wall. “Playing to 15?”

“Let’s do a couple to 21, I’ll have more time to catch up!”

They both laughed, and Jennie bent down to serve.

An hour later Celena collapsed against the side wall, flushed and breathing hard.

“Whew. Good workout!”

“Me too. Stretch out, I’ll get the water bottles.” Jennie brought the drinks in and sat down beside her. “So what else is going on in your life, besides teaching me Spanish and learning how to dig line drives out of the backhand corner?”

“Your Spanish is better than my defense, ¡no hay duda!” Celena took a long drink. “Well, I’m working on a fun project — predicting stock prices!”

“But you’re in the math department … isn’t that more an economics deal?”

“I’m taking macro from Dr. Sorenson. An elective. And it’s kind of a mathematical analysis problem, really.”

“So, can you do it? Make you rich!” winked Jennie.

“No one does it very well, but it’s been fun. And if you cheat a little, you can do it really well!”

“What do you mean? How would you cheat?”

“Well, if I guess that you’re going to serve into my backhand corner, and just as you swing, I jump that way, I have a much better chance of returning it. Right?”

“And if you guess wrong?”

“Oh, no doubt, the point is over. I’ll never make it back. But if I could look just a few seconds into the future and know which way you’re going… why, I might actually win a game now and then!”

“Or if I had the flu. That might help you, too, and that might actually happen! But … seriously … look into the future a few seconds?”

“I’m analyzing historical data. So the truth is already known. It’s just a question of whether the software, the program, knows the answer…”

“So you let it peek ahead.”

“Exactly.”

Jennie leaned back against the wall and closed her eyes. “Just don’t ever present it as real.”

“I know, I know. It’s a fun problem, though… and sometimes I can get pretty close!”

Jennie stood up. “Got a few more minutes? Let’s see how close I can get you to the front wall!”


Philip Cross stared at the screen. What was she doing?

Celena pointed to her notes. “Here’s the formula, I just don’t see how to do it in Python. Do you see what’s happening?”

Philip studied her notes, then looked back at the screen. “This is a mess. How did you get this far as a math geek and not learn any more about programming?”

“FORTRAN. ‘Formula Translator.’ Been around a long time. I’m good at it. Or, I was. Just haven’t taken the time to learn Java, or this new stuff.”

“The “new” stuff? Gosling dreamed Java up in, what, ’94? ’95? And Guido what’s-his-name created Python before that! I thought FORTRAN had gone the way of COBOL and, you know, Visual Basic?”

“Philip. Please. Doesn’t the business world still run on COBOL? And most of what us non-programmers use to talk to Oracle is really Visual Basic? You just won’t admit it. Now how do I do this recursive thing so it works?”

Philip drained the styrofoam cup. “More, please? I’m a gallon short of my daily requirement!”

She laughed and went to find the Keurig brewer.

Forecasting stocks? How can that work? he wondered. What she was trying to do here wasn’t hard … take him a minute to unscramble the index … indices … in her loops, but no big deal, she just had it backwards. But what was she really doing?

“OK, I think we got it,” he said, when she returned. “Two sugars, no cream?”

“Yup. You’re done? You’re already done?”

He smiled. “Thanks. I’ll take that as a compliment.”

“But that means I already had ninety percent of it, right?”

“Yes… you had ninety percent of it right.”

“Thank you. Want to see what it does?”

Absolutely. He nodded, getting up and moving to her chair so she could settle in at the keyboard.

“Here’s the historical data.” She opened a text file and let it stream across the screen. “Economic data, start/stop and average values of hundreds of stocks, world event indicators, temperature - it affects demand for lots of things - other weather factors, everything I could think of that might drive stock prices.”

He stared.

“So I’m in Sorenson’s class, macroeconomics, not the beginner stuff, and I thought this would be a kick. See if I could squeeze the golden goose and get the egg everyone wants - accurate stock predictions!”

“OK … “ His measly investment in Worldcom had evaporated, so he understood the wish. If only he had put the money in Wal-Mart, but he had thought he understood the tech world. It was the larger ocean, the one called economics, that his stock had drowned in.

“All right. Pick a stock, and the day you want to forecast.”

“The day?”

“Sure, why not? If you can’t predict both the value a stock will reach, and the day it will get there, what’s the use?”

“Well… Wal-Mart. Next Monday.”

“No, silly, pick a date in history.”

“But then you already know the answer!”

“But the program doesn’t. We’ll feed it the data coming up to that date… let’s say, a month before the date you pick… and see if it can tell us what the number was going to be.”

“Oh, I understand. And if it can predict stuff in history, you assume it can predict the future. Like, next Monday.”

She nodded.

“Let me see some history on Wal-Mart. Can you do that?”

“Sure, let’s just use Ameritrade’s screens.”

She pulled up Firefox and logged into her stock account. “What date are we sneaking up on?”

“My birthday — April 11, last year.”

She pulled up the history of WMT.

“How old are you?”

“Twenty. You?”

“Not supposed to ask a woman.”

“Only fair. You?”

“Twenty-six. Late start.”

“I would have guessed nineteen, maybe twenty!”

“Racquetball. Jennie and I play all the time!”

“Jennie … really? Teaches journalism? She scares me …”

“Why? She’s funny, and really smart.”

“Yeah, well …” He drained the cup. “So confident. So sure of herself. Can you imagine her being afraid of anything?”

“I guess not,” laughed Celena, “but if you could hit a kill shot like she does, you’d be confident too!”

“Let me get one more cup,” he said. “Then you can show me your stuff. Want some?”