Python

Room rules: sopython.com/chatroom Code formatting guide: tinyu...
Mar 19, 2019 12:40
@AnttiHaapala what about select_dtypes?
Mar 19, 2019 12:40
cbg
Jun 24, 2018 21:49
bold statement. Are you swimming in Java right now or something?
Jun 23, 2018 23:00
TIL there's an Ontario, California
Jun 23, 2018 18:31
Yeah true, I'm talking about a specific context.
Jun 23, 2018 18:30
@coldspeed yeah, the word "grumpy" definitely bothers some people. Also "relax". Telling someone to just relax in a heated discussion is typically a great way to escalate the situation :P
Jun 23, 2018 18:25
cbg
Jun 22, 2018 23:47
and so it no longer supports complex numbers the wrong way around, interesting.
Jun 22, 2018 22:56
..okay we tied :(
Jun 22, 2018 22:35
if so I fail at 40
Jun 22, 2018 22:33
.Net front-end thing. That counts as "knowing what the thing is", right?
Jun 22, 2018 22:18
Yeah I don't know if you can order them. Ha someone got a gold badge in in 2012... and has remained the only gold-badger ever since.
Jun 22, 2018 22:04
@wim soon to be 23 if you answer 13 more questions!
Jun 22, 2018 22:02
looks especially like magic to me having never touched matlab :P
Jun 22, 2018 21:55
are his answers as confusingly great in matlab as well?
Jun 22, 2018 21:36
@AndrasDeak thanks :) I saw a similar use of ufunc.at deep in a Divakar answer once that prompted me to figure out how it worked.
Jun 22, 2018 21:00
@AndrasDeak Yeah, I was trying to be clever and make a mistake in the first version with ptp!
Jun 22, 2018 14:59
Ahh, nice!
Jun 22, 2018 14:52
def binmaxes(bins, weights):
    out = np.zeros(bins.max() + 1)
    np.maximum.at(out, bins, weights)
    return out
Jun 22, 2018 14:51
Ah no sorry, np.zeros(bins.max() + 1).
Jun 22, 2018 14:43
@AndrasDeak I'm not sure what you mean. If you let out = np.zeros(bins.ptp() + 1), then the array elements act like indices into the zero array with corresponding weights.
Jun 22, 2018 14:16
np.maximum.at(out, vec_o_num, weights)?
Jun 18, 2018 01:45
Nice answer there though
Jun 18, 2018 01:44
I thought it was some ridiculous sorting algorithm somehow related to chess that even Google wasn't helping with :(
Jun 18, 2018 01:40
cbg, no but I'm interested!
Jun 17, 2018 15:22
You can try pd.to_numeric with errors='coerce' to force all the non-convertible elements to NaN.
Jun 17, 2018 00:31
gone!
Jun 16, 2018 17:15
Semimutable view ;)
Jun 16, 2018 17:11
So M[...] is a non-owning view into the 0-D array underneath the array scalar I guess
Jun 16, 2018 17:06
Yeah, I agree. The kind of bug only a library implementer is likely to come across though at least :)
Jun 16, 2018 17:02
Still trying to wrap my head around this.
Jun 16, 2018 16:58
There's a lot about NumPy I don't really understand :P
Jun 16, 2018 16:57
Ahh, I saw it shared in the xtensor Gitter but it looks like it's already been brought up as a potential bug.
Jun 16, 2018 16:52
Yeah, I expected that. I just thought it was weird that M[...] is a view into.. not a scalar? Which is why WRITEABLE : True?
Jun 16, 2018 16:28
In [62]: M = np.int_(1)

In [63]: M[...].flags
Out[63]:
  C_CONTIGUOUS : True
  F_CONTIGUOUS : True
  OWNDATA : False
  WRITEABLE : True
  ALIGNED : True
  WRITEBACKIFCOPY : False
  UPDATEIFCOPY : False

In [64]: M[...] = 0
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-64-7bdc41e675c4> in <module>()
----> 1 M[...] = 0

TypeError: 'numpy.int64' object does not support item assignment
Jun 16, 2018 16:28
@AndrasDeak That reminds me of this peculiarity I saw.
Jun 14, 2018 00:47
@idjaw Done, first one looks good.
Jun 3, 2018 15:08
cabbage
Jun 3, 2018 03:19
rhubarb!
Jun 3, 2018 03:16
@chrisz dictionary views objects are set-like, so still O(1) in Python 3
Jun 3, 2018 03:01
It sounds like you need a hands-on kind of book to get an idea of how you would use machine learning. One I've heard good things about: Hands-On Machine Learning with Scikit-Learn and TensorFlow: Concepts, Tools, and Techniques to Build Intelligent Systems
Jun 3, 2018 02:24
You can build Scikit on top of Tensorflow even, see here. Scikit learn gives you a bunch of algorithms that you can use off the shelf across a bunch of domains in machine learning. Tensorflow gives you low level tools and GPU support, and is usually used for deep learning. It's not a question of "one or the other" in general, it depends on what you're trying to do.
Jun 3, 2018 02:13
And it is far more low level
Jun 3, 2018 01:59
Scikit is nice and easy to use, but for specific areas you might find some juicy R packages in CRAN that don't (yet) have a similar Python library.
Jun 3, 2018 01:57
Yeah, I imagine you'd have to get familiar with tensorflow internals.
Jun 3, 2018 01:52
Lol no sorry I meant like, do you find it reasonable to work with? I've heard bad things.
Jun 3, 2018 01:51
@chrisz How do you find the C++ API, out of curiosity?
Jun 1, 2018 16:37
Saw that recently as well and had the same feeling :/
Jun 1, 2018 16:30
Is it the one titled with "A puzzle a day to learn, code, and play"?