Live data from Hacker News

Pandas vs. Julia – cheat sheet and comparison

datascientyst.com

81–90 of 138 posts

Re: Pandas vs. Julia – cheat sheet and comparison

#81

Earlier quoted context omitted.

We should nurture more accessibility, in this case, mobile compatibility. For instance, consider someone who has limited access to desktop computers and have to go by with a mobile device. These individuals do exist, and their access is as legitimate as any other.

Mobile compatible websites are strictly worse though. It's why almost all desktop websites are just a hideous jumble of boxes these days. It's virtually impossible to make a website that is well designed on both desktop and mobile. As long as the affordances of mouse+keyboard and touchscreen are as different as they are, one of the user groups needs will suffer a detrimental compromise.

An empty HTML page works on both. Add some margin and spacing and it keeps working.

After that, what you can do is ruin it, targetting a webpage for a specific screen size.

Re: Pandas vs. Julia – cheat sheet and comparison

#82
post #78

Anxiously waiting for pandas to get its mojo. If there is any Python library that needs it, this is it.

I wish Python catches up to Julia in performance. No sense rewriting a trillion lines of code for what is a really pleasant syntax & ecosystem already. But this is a language flamewar thing, probably not a constructive comment, sorry.

You can just use Polars[0] instead of Pandas and easily beat both Pandas and DataFrames.jl

Pure Julia is faster than pure python, but there are non-pure python tools available in the python ecosystem for a ton of things.

[0] -- https://www.pola.rs/

Re: Pandas vs. Julia – cheat sheet and comparison

#83

Earlier quoted context omitted.

What do you mean? Julia is 1-indexed.

Ok, in that case Python would be 0, 1, 3 and Julia 1, 2, 3. My point is that the example explicitly skips an index in the definition of a data frame for Python, but it doesn't for Julia.

Surely Python would not skip the 2.

Re: Pandas vs. Julia – cheat sheet and comparison

#84

Earlier quoted context omitted.

I have done both complex and trivial stuff in both languages and Julia isn't more inconvenient for trivial things.

Any examples? I've found Julia far easier for simple things than python. Most modern problems are mathematical and nature and I think it's pretty objective that julia looks closer to the mathematics. ----Some tests of very simple tasks in both languages. At its most basic the obviouses becomes different: Let's try to get a very simple object: a 3,3 matrix of random booleans in both languages: Julia: A = rand(Bool,3,3…

It’s funny that people used to get on Python’s case for not being object oriented enough, and now we’ve come around to folks thinking Python should just throw a function for everything into the default namespace …

Re: Pandas vs. Julia – cheat sheet and comparison

#86
I've just started getting into Julia for one of it's best use cases: It's super easy to do arbitrary precision math. But you have to be very careful when using string literals with BigInt or BigFloat:

  julia> setprecision(1024)
  julia> a=BigFloat(1.0E-300)
  1.000000000000000025059091835208759685696146807703705249925342319900466043184051484676302812181950100894962306270278254148910311464998804130812246091606190182719426627934584275510414782787015070222639260603793613924359775094030143866141479125513590882591017341692222921220404918621822029155619541859418525883262e-300
Notice without quotes on the literal you only get ~15 decimal digits of precision because the parser treats the literal as a double and then passes that to the BigFloat variable.

  julia> a=BigFloat("1.0E-300")
  9.999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999999988e-301
With quotes we get the full ~308 decimal digits of precision for the configured 1024-bit binary precision.

Now we can add it to 1.0 to validate the precision of a calculation and use the @printf macro for C-style formatting to round the output to 308 decimal digits:

  julia> b=BigFloat("1.0")
  julia> using Printf
  julia> @printf("%.308f\n", (a+b))
  1.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000
I'm not sure why this is the default behavior, it seems like a really easy way for people to screw up their calculations, especially scientists that don't do a lot of programming.

Re: Pandas vs. Julia – cheat sheet and comparison

#87
post #2

Nah, I'll do it with SQL

SQLite is often much faster then dataframes jl and pandas.

SQLite is good for a bunch of stuff, but it's terrible for analytic workloads. Not even in the same ballpark for pandas, let alone Julia

Re: Pandas vs. Julia – cheat sheet and comparison

#88
post #86

I've just started getting into Julia for one of it's best use cases: It's super easy to do arbitrary precision math. But you have to be very careful when using string literals with BigInt or BigFloat: julia> setprecision(1024) julia> a=BigFloat(1.0E-300) 1.0000000000000000250590918352087596856961468077037052499253423199004660431840514846763028121819501008949623062702782541489103114649988041308122460916061901827194266…

I actually find the string macro syntax even more convenient: `big"1e-300"`.

Re: Pandas vs. Julia – cheat sheet and comparison

#89
post #21
post #2

Nah, I'll do it with SQL

Same here, I don't get the point of this other that "don't want to learn SQL".

You use both. Once your data fits comfortably in memory it's naive to try to build histograms, pivots and charts using pure SQL.

Re: Pandas vs. Julia – cheat sheet and comparison

#90

The thing that keeps me coming back to Julia is the ability to pipe (or whatever you want to call it). It makes DataFrame operations a lot cleaner since I don't need to modify in place or create new DFs at intermediate steps in a process. Here's a video showing this sort of workflow in R: https://youtu.be/W3e8qMBypSE

I'm still not entirely convinced that pipes aren't an anti-pattern. Absolutely an improvement over nested function calls:

a(b(c(d))) vs d |> c |> b |> a

but I'm not convinced pipes are better than more verbose code that explains each step:

step1 = c(d)

step2 = b(step1)

result = a(step2)

I've written a lot of tidy R and do understand the specific use cases where it really doesn't make sense to use the more verbose format, but generally find when I'm building complex mathematical models the verbose method is much easier to understand.

Post reply on HN