Live data from Hacker News

Python is not a great language for data science

blog.genesmindsmachines.com

51–60 of 339 posts

Re: Python is not a great language for data science

#51
post #43

Isn't the author saying that Python + Pandas is almost as good as R, but Python without Pandas is less powerful than R. I can't help to conclude that Python is as good as R because I still have the choice of using Pandas when I need it. What did I get wrong?

you missed the "almost as" in your first sentence.

also, we didn't define "good".

Re: Python is not a great language for data science

#52
post #8

From many practical points, Clojure is great for data. And you can even leverage python libs via clj-python.

In the past few years I have seen some serious efforts from the Clojure community to make Clojure more attractive for data science. Check out the Scicloj[1] group and their data science stack/toolkit Noj[2] (still in beta) as well as the high-performance tabular data processing library tech.ml.dataset (TMD)[3].

- [1] https://scicloj.github.io

- [2] https://scicloj.github.io/noj

- [3] https://github.com/techascent/tech.ml.dataset

Re: Python is not a great language for data science

#53
post #31
post #16

I think a lot of this comes down to the question: Why aren't tables first class citizens in programming languages? If you step back, it's kind of weird that there's no mainstream programming language that has tables as first class citizens. Instead, we're stuck learning multiple APIs (polars, pandas) which are effectively programming languages for tables. R is perhaps the closest, because it has data.frame as a 'firs…

What is a table other than an array of structs?

It’s not that you can’t model data that way (or indeed with structs of arrays), it’s just that the user experience starts to suck. You might want a dataset bigger than RAM, or that you can transparently back by the filesystem, RAM or VRAM. You might want to efficiently index and query the data. You might want to dynamically join and project the data with other arrays of structs. You might want to know when you’re multiplying data of the wrong shapes together. You might want really excellent reflection support. All of this is obviously possible in current languages because that’s where it happens, but it could definitely be easier and feel more of a first class citizen.

Re: Python is not a great language for data science

#54
Shell is the best language for data science. Pick the best tools for each of getting data, cleaning data, transforming data, and visualizing data, then stitch them together by sheer virtue of the fact that text is the universal interoperable protocol and files are the universal way of saving intermediate stages of data.

Best part is, write a --help, and you can load them into LLMs as tools to help the LLMs figure it out for you.

Fight me.

Re: Python is not a great language for data science

#55
post #46
post #31

Earlier quoted context omitted.

What is a table other than an array of structs?

I would argue that's about how the data is stored. What I'm trying to express is the idea of the programming language itself supporting high level tabular abstractions/transformations such as grouping, aggregation, joins and so on.

Sounds a lot like LINQ in .NET (which is usually compatible with ORMs actually querying tables).

Re: Python is not a great language for data science

#57
Python was a great language for data science, when data science become a mainstream thing.

it was easy to think about the structures (iterators) it was easy to extend. it had a good community.

And for that, people start extending it via libraries.

There are plenty more alternatives now.

Re: Python is not a great language for data science

#58
post #29

What makes Python a great language for data science, is that so many people are familiar with it, and that it is an easy language to read. If you use a more obscure language like Clojure, Common Lisp, Julia, etc., many people will not be familiar with the language and unable to read or review your code. Peer review is fundamental to the scientific endeavor. If you only optimize on what is the best language for the ta…

I can't speak for Julia - never used it; never used Common Lisp for analyzing data (I don't think it's very "data-oriented" for the modern age and the shape of data), but Clojure is really not "obscure" - it only looks weird for the first fifteen minutes or so; once you start using it - it is one of the most straightforward and reasonable languages out there - it is in fact simpler than Python and Javascript. Immutable-by-default makes it far much easier to reason about the code. And OMG, it is so much more data-oriented - it's crazy that more people don't use it. Most never even heard about it.

Re: Python is not a great language for data science

#59
post #4

Earlier quoted context omitted.

That's not why it's used in data science though. Lots of data scientists use Python all day and have no concept of ever working in a different field. It's used in data science because it's used in data science.

It's used in data science because no other language has this level of library support. And it got this unprecedented level of support because right from the start it made its focus clear syntax and (perceived) simplicity. There is also a sort of cumulative effect from being nice for algorithmic work. Guido's long-term strategy won over numerous other strong candidates for this role.

I think the key thing not obvious to most data scientists is they're not using python because it meets their needs, it's because we've failed them. twice.

1. data scientists aren't programmers, so why do they need a programming language? the tools they should be using don't exist. they'd need programmers to make them, and all we have to offer is... more programming languages.

2. the giant problem at the heart of modern software: the most important feature of a modern programming language is being easy to read and write. this feature is conspicuously absent from most important languages.

they're trapped. they can't do what they need without a programming language but there are only a handful they can possibly use. the real reason python ended up with such good library support is they never really had a choice.

Re: Python is not a great language for data science

#60
I think this expectation that data science code is a thing you write basically top to bottom to get some answers out, put them in a graph and move on with your life is not a useful lens through which to evaluate two programming languages. R definitely is an efficient DSL for doing stats this way, but it’s a painful way to build a durable piece of software. Python is nowhere near perfect but I’ve seen fewer codebases that made my eyes bleed, however pretty the graphs might look.
Post reply on HN