« first day (3947 days earlier)      last day (984 days later) » 
01:00 - 18:0018:00 - 00:00

1:06 AM
Winner of the "Can you be more specific?" award: stackoverflow.com/questions/68674933/…
 
 
2 hours later…
3:13 AM
i don't think it needed specifying... I think it was just a question written by a spoiled person
 
"I was working it out but I'm still having trouble with the problem in python" I am just guessing they didnt know how to write a question, if I am giving the benefit of doubt, if they at least specified they were working on it
I have seen questions where the title is just the question itself they were given
 
 
2 hours later…
5:05 AM
@python_user Collatz Conjecture solution kthxbye?! Shopping-cart calculator for fruit.
 
laurel, the title is usually something like that and then the actual description also has that
 
@roganjosh 'cd{2,}r'
 
 
3 hours later…
7:57 AM
cbg
 
cbg
@smci That looks rather regex-y to me. One should never mix regex and alcohol.
 
8:11 AM
Hmm, they've redesigned the profile layout. It looks like the profile views counter was culled in the process, which is a shame. Now I don't know the scale of controversy I generate :'(
 
I guess I was nearing 700 views last I checked
 
I got to ~7,300 the last I went on my profile, which was totally disproportionate to my numerical reputation when I look at other profiles. I took it more as an infamy counter when I was actively curating the main feed
 
idk about the SE API, but if there is one for profiles, then it must have it there maybe
 
 
2 hours later…
9:56 AM
The edit to my answer here is frustrating. deceze fixed it and I had tried my hand at the table formatting but it was a garbled mess. Despite that, the edit preview showed it exactly as I expected until I clicked "save". Instead of answering what he changed, he just cleared my comments asking what he did. Has anyone had this issue?
I don't get why the live preview of my answer didn't match what the post ended up looking like :/
 
hello! I need your help please! I have a Django app with two different GET API, one with the URL "api/app/b64/<id>" and one with a similar URL except that "b64" is replaced by "pdf" but the app cannot recognize it when I call it!
 
I don't use django but I'm pretty sure we'll need to see urls.py
 
from django.contrib import admin
from django.urls import path, include
from .views import *
from rest_framework import routers

from rest_framework_simplejwt.views import TokenObtainPairView, TokenRefreshView

router = routers.DefaultRouter(trailing_slash=False)

router.register(r'app/operations/', OperationViewSet, basename='get_queryset')

urlpatterns = [
path(r'api/', include(router.urls)),
path('txttobase64/', convert_txt_to_base64, name='txttobase64'),
path('api/app/operation/b64/<id>', get_app_b64, name='get_app_b64'),
how come the app can't recognize the pdf URL???!!
 
I don't know?!?!??!
Maybe someone else more familiar with django will be able to help debug this, but I don't know where to start tbh sorry
path(r'api/', include(router.urls)), already makes me suspicious that this isn't the right module, though
 
10:16 AM
ok thank you
I will try to comment it out
 
I don't think that's what I was suggesting. I'm suggesting that there's another file where you haven't updated the routes
 
but I don't think it's the source of the problem because the b64 API works fine
the js file is up to date
I'm using a Vuejs app
 
I'm not talking about JS. You have another urls.py file
I'm digging back 5 years in memory here to when I played with django. But you have another file with application-level URLs
 
there can't be two files with the same name in the same directory
 
I never said they're in the same directory
 
10:19 AM
yes there are two urls.py but the one I'm talking about is the one of the only module I use
 
Do you know what include(router.urls) does?
 
there is one global one and another one inside my module
it includes all the registered routes to the paths or urlpatterns
 
The other thing to look at is that you haven't prepended all your other routes with r'', and I thought they also needed a caret. Shooting in the dark, though
django + regex. Nightmare juice for me
 
10:43 AM
Is there a tutorial how to setup Visual Studio Code, such that I can use virtual environments.(Windows 10) I read that you need Anaconda for it. Or is it rather about setting up my environment and activating it correctly?
 
@roganjosh i think he pressed enter. haha
 
@SAJW Oh goodness, you don't need Anaconda!
 
i can't claim to say what you saw during your own preview though
 
@ParitoshSingh Is that all it takes?
 
it seems like that to me, but i've never tried writing tables in SO.
basically the start of the table needs to be separate from the text above, looks like. this is what im seeing on the edit*
 
10:46 AM
@SAJW Once you install VSCode you just need to open the top-level directory that contains your virtual environment and it'll be available as an option to run in. Is your question really about VSCode or virtual environments in general?
 
looks like the question just comes from a slightly misguided assumption. So, to challenge the assumption directly, anaconda is not the only mechanism for making environments in python, far from it. and editors usually don't really have a role to play in how environments are created, (with some exceptions), editors rather only need to be told to hook up to the correct environment.
 
Mmh, I think about virtual environments rather than VSCode then.
 
I've kinda lost touch with Windows recently, but I think you should be able to do python3 -m pip install virtualenv and then do python3 -m virtualenv env
 
well python even ships with venv now
 
Oh, even easier, then
 
10:51 AM
they even give windows specific examples, how nice of them
 
I think I probably missed that because of PATH issues and only seeing the python -m light late in the day
 
yeah, i will admit PATH issues "may" have driven me insane on windows when i started, if i hadn't been foolish enough to install anaconda instead of python... but that ended up helping me :P
instead, i just "ran" things and only later found out that there's a lot of black magic that went onto making things work
@roganjosh btw, just in case you were wondering, this and this was what i compared visually.
 
@SAJW you don't need Anaconda. Just use a Virtualenv as they told you.
then access your virtualenv with ./<env name>/Scripts/activate if you're on Windows
 
Ok :)
 
or "source <env name>/bin/activate" with Linux
or you can use WinPython if you just want a portable VSCode + Python environment
you can access the virtualenv directly from a terminal that you open on VSCode, your Python projects should be placed inside it.
 
11:01 AM
do I need to change the interpreter to the one in the environment folder? to run&debug with the desired environment.
 
Click the environment in the bottom left
That'll open a dropdown menu at the top which should be able to see the virtualenv you've made in your project directory
 
you are not on the latest and greatest 3.9.6 :p
 
I am on other projects :P
@ParitoshSingh frustrating that the preview didn't tell me that :'(
Or, y'know, the mod that fixed it and just swept my question away
 
11:19 AM
Has anyone else experienced an async program freezing when the PC is suspended? It doesn't always happen, and I'm not even sure if the entire program freezes, but that seems like the most likely explanation. The program grabs urls from the clipboard and downloads them, and sometimes I notice it never finishes a download, and other times I notice it stops polling the clipboard
Could theoretically be a bug in aiohttp and pyperclip, but that seems unlikely at this point
Windows btw
 
11:34 AM
So, I install the latest version of Python on my laptop and then use venv right?
 
pretty much
 
The one thing Anaconda could do is choose the version of python you install. The other thing you could use is pyenv. But for now, let's keep it simple. What is your OS?
 
windows 10
 
Sorry, just realised you already stated that. Losing my touch :/
 
@Aran-Fey hm, you are reminding me of some strange behaviour i have noticed with stuff like overnight game downloads or long-running game bots that i used to use, which would go all kinds of wonky if i would close my laptop lid. (what's weird is, i swear i stopped it's auto-sleep behaviour). Once that would happen it would never "run right" after, until i restarted it.
Unfortunately that's all i have for you in this matter
 
11:39 AM
@SAJW Yes, you can just install it. If it asks you to add to PATH, say "yes"
 
So you're saying it might be Windows' fault? Hmm
Oh, I should probably try to use the other event loop
 
eventually i had to leave my laptop running with lid open, and only allow it to turn off the screen but without going to sleep/locking the screen
but yeah, i don't yet know till date what was the actual culprit
 
should I disable Path-limit or let that be like it is?
 
Windows don't care; Windows do what it wants! I stopped it downloading updates by itself and restarting my laptop. Did it listen?...
 
let it stay, it's fine. or atleast in the windows world, it's better to deal with the issues of being on windows everywhere.
 
11:43 AM
@SAJW What is the path limit? actually this could be quite serious, so I genuinely want to know what you're asking here
 
windows has the 256 or 300 or whatever limit for paths
 
260 chracters
 
before it goes "oh ha, what file, jk"
 
It can actually do more than 260 chars, but you mess it up if you use xpath
 
it's a question the python installer makes
 
11:44 AM
That's not good. I don't know why I don't remember it asking me this when I was installing on Windows
 
I downloaded from here python.org/downloads
 
If it's warning about that, click "no" and we can fix the path later
 
yeah yeah, you're fine. my vote is to leave it as-default
 
no, it just offers me to disable the limit, not that i have to, setup is finished right now
 
which iirc is "dont disable limit"
 
11:46 AM
Oh, then disable the limit
It isn't even the limit. I'm relatively sure it's 512 chars, or maybe 256. Where 260 comes from is... well, no idea
 
not 512, that's too high for sure. i've hit this wall with an earlier number
 
Only in xpath or some command-line nonsense it does
 
google says it's actually 260
 
Well then this is annoying. It can't even make up its mind?
 
so on my global environment I don't install any of numpy or other libraries(?), only on the virtual envs?
 
11:49 AM
The yam? I might just back out of this before I screw something up for you @SAJW
 
well I clicked it, and in the worst case I reinstall windows
 
ideally yeah, use environments and life's good
also.. do as i say, not as i do. ;)
(to be fair, i have one single common environment for when i can't be bothered to make environments, and then i make environments on proper projects. i still don't recommend installing stuff in the base/global environment)
 
@ParitoshSingh that sounds reasonable to me
I have a main env I can activate with a bash alias, and separate environments for whatever needs it
 
@SAJW at the end of the day, you do need python on your PATH so that you can use python3 <some_command_here>
This is the first I've heard of the 260 char limit
 
well now I got the latest python installed
 
11:54 AM
@roganjosh you're a lucky man. i discovered it in one of our projects. It was not fun.
 
Are you in cmd or powershell?
 
We were creating these rather long folder names based on file names, and every so often the file we'd get would result in full path that was really long.
 
@ParitoshSingh I've had xpath truncate my PATH before without warning. It only decides to tell you after it does it
 
and windows would just start telling you that the file does not exist, and refuse to navigate that far.
@roganjosh nice! that sounds like another fun pitfall
 
"btw I've done what you asked, but you just done yammed your system"
 
11:58 AM
@SAJW Nice. i'd say next up, make an environment just to get a feel for it. and then you can start playing around with it.
 
Before that, I think they should open a cmd window and type python
 
Python 3.9.6
 
Then let's see whether that's a) recognised and b) what version it enters
 
it says
 
Nice!
So if venv is packaged with Python now, you should be able to open a terminal in your project directory and do python3 -m venv env
I think Windows 10 decided to stop you opening terminals by holding down shift + right click, because reasons....
In which case, open the search bar, search "cmd", then navigate to the directory. You can activate the right click option but it's faffing
 
12:02 PM
also, looking into the 260 limit it looks like windows stores the drive letters, the first colon and slash, and the null terminator separately.
it's why it;s 260. it's just 256 + 4 extra things not stored with the path
Although i don't understand why the null terminator wouldn't be stored with the string. that's strange, isn't it?
 
The limit itself seems strange
 
once it is seen as 256 + 4 it seems less strange though
 
'python3' is not recognized as an internal or external command,
operable program or batch file.
 
blame every bad decision on "backward compat".
 
if you are on windows its probably py3 or py I guess
 
12:04 PM
Ok, so it hasn't been added to the PATH
 
on windows use python, not python3
or py, or py3 sure. i can't keep these things straight anymore
 
now there is a folder called env in my projectfolder :)
python it is
 
nice :)
now to activate it, you should have a scripts folder
if you navigate to it via your cmd (cd path/to/scripts), you can then run the activate by typing activate
 
for this guy though py seemed to have worked chat.stackoverflow.com/transcript/message/52575199#52575199
 
I've never used py across Windows, Ubuntu or MacOS
 
12:10 PM
me neither but I read about it somewhere so I just recommend to users who cant have it running, py or python along with 3 the combinations are what I try nowadays if I have no clue :D
 
@ParitoshSingh so env\Scripts\activate in my case?
 
i dont think you'll be able to run that in one go on windows
at least, i've always had to navigate to the folder first, and then type activate separately
 
it works
(env) C:\Pythonprojekte\hangman>
 
great! youre all set
 
so now I click in VSCode in the bottom left and choose this environment?
 
12:12 PM
yep!
and if vscode doesnt detect it you should be able to give it the path yourself, and then vscode can pick it up
 
is there a way I can do this without having to write a helper function that both downloads and writes to a file? the following downloads using multiple threads, but writes it using a single thread
with ThreadPoolExecutor(32) as pool:
    futures = {pool.submit(foo, arg): arg for arg in arguments} # foo returns a json
    for future in as_completed(futures):
        with open(f'{path}/{futures[future]}.json', 'w') as json_out:
            json.dump(future.result(), json_out)
 
Ok, so I want to load a dictionary (a file with words seperated by new lines) into an array, do I need any of numpy/earthpy for this?
each index should contain one word
 
for context, foo is actually a method in my class, I dont want to write a private helper (__download_and_write) just to have this feature in my class
 
What is the need for concurrent writes?
 
file IO can benefit from threads?
if not then I will just let this implementation be
 
12:22 PM
That isn't a need though, is it?
 
no :D, maybe I am micro optimising
arguements can be of length 100 - 200 in some cases
 
I think so. I suspect that the gains will be marginal even if you find a fancy way to do this
 
I could create a pool of another 32 threads after the foo call and write this, but I end up creating twice as much though
 
I thought I was retro by using Futures but I've seen it a couple of times today. I hope I've not set some trend in motion
 
I have asked like 3 questions realted to this in this week, so maybe it must be me, but from what I know it is better than threading.Thread, where you cant even for some reason get the return value without subclassing
 
12:27 PM
Futures are even funnerer. You kill the code but they keep going (at least in my hodgepodge setup). The best analogy I found was the youtube videos where someone stamps on a spider and all the babies swarm out
 
how have I not watched that video yet!
 
I didn't think I'd put a Marketing spin on the situation, but maybe my mind is polluted :/
 
its almost friday eve for me, so might as well call it a day and watch youtube
 
I don't know the name of the vid off the top of my head, but it's unpleasant. You can watch them opening sacs of tarantulas and I'm not overly keen on that either, even though I used to own 3 including a Goliath Bird Eater
 
I just googled Goliath Bird Eater and now I will just stop with my google image search
 
12:39 PM
Georgina. She had chips on every shoulder. George, the Chilean Rose, was much more friendly
 
one more?
 
Black Curly Hair. He didn't have a name... he escaped and lived under the washing machine for 6 months
 
laurel, what did he feed upon?
 
And by "escaped" I mean we got burgled and they tipped all the tanks over for good measure
Escaped crickets. They did escape and bred under the fireplace
 
whelp, looks like im glad room6 is not driving the youtube recommendations :P
 
12:57 PM
Who in their right mind would mess with a tarantula tank while burgling
 
they might have seen the tarantula and freaked out ;) and thus messing it up, and freaking up more
 
They didn't have to. They just had to take the lid off and tip it over. We found George a couple of days later on the roof just above the stairs
2 weeks later we found one of the snakes wrapped around the curtain pole in the kitchen
... it was an interesting house
 
@roganjosh nice
Complete little ecosystem. "We've had moss growing there since the flood, so the crickets had food..."
 
No idea what the crickets ate. Presumably they helped keep the house clean. It was an old, mounted gas fire so they could just take in the radiative heat. If you ever went to try get them, they could just scurry into the wall
All was well, apart from the chirping at night...
And the tarantula under the washing machine, waiting.
 
As long as it didn't steal socks
 
1:09 PM
Maybe I've blown the case wide open on missing socks
 
"We found George a couple of days later on the roof" is an interesting message to encounter for those of us that catch up by reading upwards through the transcript.
"Cat? Unusually mobile houseplant? Elderly yet spry relative? Ah, tarantula."
 
Oh, there was no mistaking George. Unfortunately you can't beckon tarantulas (or I was a bad trainer) so it took ladders
 
I'm not particularly arachnophobic, in fact I sympathise with spider. But still, looking out a roof exit and seeing a tarantula right there at eye level sounds more than a bit creepy
 
George wouldn't hurt a fly...
 
A few week ago I looked up a relative's attic, and seeing a dead hornet like that was scary enough
probably some old instincts kicking in
 
1:18 PM
Mainly because he couldn't catch it, but he probably wouldn't have hurt it if he could. Just give it a kiss
 
Ah, one of those vegan spiders
 
I have 2 list.
 
Ok, so far so good
Spiders are welcome guests in my home as long as they obey the non-aggression accord that I communicate to them telepathically
Try the continental breakfast, it's "all the crawlies in my house that don't obey the accord". I'm looking at you, ants that take my Pop Tart crumbs without permission
 
I hate big flies more. The buzzing in my room in summer is bad; I need a screen for my window. A Georgina on their houses!
 
I have 2 list
listOne = [a,b,c,d,e,f]
listTwo = [c,d,a,e]

I need to write a function that compare two list and bring me the value which not common in that list. In that case [d,f]

How U am going to write the function.
How I am going to write the function
 
1:28 PM
if you dont mind about the order and count, you can use a set
 
Have you done any searching/research on this at all @SushenBiswas?
 
And what went wrong?
 
I can tell which one is big by lcalling len functio
 
But that isn't what you're trying to do, is it?
 
1:30 PM
No
 
So you searched for the wrong thing
 
Yes
I am stack in my head
 
That doesn't make sense. But your requirement did so you could search around that
 
have you checked your output? d is common between the two lists
 
sorry I wright wrong it will be b and f
 
1:33 PM
you can try taking in roganjosh's suggestion on searching related to that, and what I have suggested earlier
 
30
A: How can I compare two lists in python and return not matches

zondoJust use a list comprehension: def returnNotMatches(a, b): return [[x for x in a if x not in b], [x for x in b if x not in a]]

I find this but cant understand
 
What part do you not understand?
The first (accepted) answer is actually pretty unclear
 
yeah, the most upvoted answer is a lot better imo, especially if duplicates is not an issue
 
X for x in a
 
why has no one mentioned symmetric_difference in that answer?
 
1:38 PM
It isn't X for x in a. Python is case-sensitive so it's actually x for x in a
 
I'd need about three more test cases before I felt comfortable giving any suggestions. If the input is ["a", "b", "b"] and ["b", "c", "d", "e"], what is the desired output?
 
a = [1, 3, 5]
print([x for x in a])
 
Last andwer make some sense but why it return unic value
 
@SushenBiswas you don't seem like a programmer. Have you read a python tutorial yet? It would immensely help you with writing python to solve problems.
 
The last answer, as in the one written by Aaron Lael? That's the only one that doesn't make sense, in my opinion. Why is he calling a.lower() when there are no strings in the problem?
 
1:41 PM
I know syntax but new
 
If you know the syntax, then you should know what x for x in a does
 
@SushenBiswas you don't know syntax either, and programming is a lot more than syntax. Read a tutorial, please.
You can't build without foundations.
 
@kevin, @roganjosh
 
@Kevin Probably because they cargo-culted from elsewhere and "you, too, can do this thing!"
 
now, now
 
1:43 PM
@AndrasDeak thanks for helping.
 
Maybe they had another question open in a different tab, along the lines of "how do I find all the lowercase characters in a string?", and they got the submission boxes mixed up
 
@AndrasDeak do you have a better explanation?
 
Explanation no, less ad hominem phrasing yes :P
 
Ok, I'll rein it in
 
Maybe they thought "well, the problem is underspecified because they provide only foo and bar as inputs, while expecting the output to depend on a and b, so maybe I'll write a tongue-in-cheek nasal demons answer that does whatever I feel like"
 
1:46 PM
Wrong rein. Silly English language :/
 
Is it?
I thought it was the right one
 
Ah, no, it is right.
 
You ever notice that you can have tarantulas "at your beck and call", but not just at your beck?
 
that reminds me of those word pairs that sound horrible the other way around
 
or your back. shudder
 
1:47 PM
We'd love some quiet and peace.
(that might not be the best example, I don't remember)
 
Butter and bread
 
Spiders don't have ears, so you might expect that you can have them at your beck (a visual hand signal) but not your call (audible signal)
 
@roganjosh yes!
 
Stop going fourth and back.
 
shine and rise
 
1:48 PM
I guess it's best with idioms
 
..wait, shine what?
 
@Kevin don't they hear still? Crickets have "ears" (auditory sensors) on their legs
at least grasshoppers and bush crickets do, as far as I know
 
Google tells me that their hairs can sense vibration, so the scientific consensus is "eh, [does that hand gesture that means 'kinda']"
 
oh wow, i just realised i never knew what beck meant. thanks!
 
@ParitoshSingh it's short for beckon, right?
@Kevin yeah, that doesn't count in my book
 
1:50 PM
call and beck
 
that... makes a lot of sense. i never connected the two till now, whoops :P
 
"beckon" seems to be the root word, with "beck" the shortened offshoot. Same etymological root as "beacon"
 
to be fair I only had a vague idea of what beckon meant until a few years ago
@Kevin mmmh, bacon
 
For me, a lot of words i just pick up from context. beckon was one of them.
 
yup
 
1:52 PM
"call and beck" was my dystopian rearrangement. The phrase is "beck and call" and if someone is subjected to it, it means they have to do the wishes of someone else. Beckon is a gesture to tell someone to do something
Like you would do a swooping motion with your arm while telling your dog to come to you
It can have slightly more positive connotations like angels beckoning you to heaven, depending on whether you think that's a good thing
 
The angel shakes its bag of human treats and says "pspsps"
 
and we know that pspsps is a universal law
 
I wonder how many countries use pspsps
 
It does seem oddly widespread, despite not working at all
 
chchch is the the word, sorry.
 
2:01 PM
I can't find a way to type the sound we make over here, but it works a bit from my experience
 
Alright, everybody go read up on the international phonetic alphabet and we'll reconvene in 30 minutes
Currently trying to psychically inspect the state of my windpipe to determine whether the initial p qualifies as a Bilabial ejective fricative
 
That reads like a self-webMD diagnosis
 
"My glottis isn't pumping upwards like I expect... Is this normal?"
Luckily I can still lead a rich and fulfilling life
 
2:19 PM
we do more like ts-ts-ts (but our word for cat starts with that sound)
@roganjosh I thought beckoning was specifically a gesture to invite someone closer
 
Here it's more like a reverse "t" if that makes any sense
 
@AlexandreMarcq nope :p
 
2:36 PM
Well instead of pushing the tongue against the teeth to make the "t", you do the opposite, kind of
It'll be clearer if one day by mistake you visit France and see someone calling a cat
 
@AndrasDeak It is, but it implies some command. It's hard to describe. You might beckon a swimmer going into dangerous water, so you're basically saying "no, come back!" or, like I said before, telling a dog to come back. Imagination can be beckoning too, like being drawn to some idea (in which case, the idea has an element of control)
You wouldn't beckon someone for a hug (I don't think)
And... I'm not going to take that example further. It stands by itself.
 
2:52 PM
beckoning is when the freshly baked pie on the windowsill forms a phantom hand from its wisp of steam, and levitates you pleasantly towards itself
 
I should have just left it to Kevin to explain. That "phantom hand" covers pretty much everything I was failing to explain
I suspect Tom and Jerry, or the like, got there first, but I'm ok crediting Kevin :P
 
I too was imagining cartoons from that general era
 
Yeah, Family Guy might have taken this example too far
 
I can almost see it in my head. Maybe Garfield?
It's a woman (whose face you never see) putting a pie on the windowsill to cool
 
I'm sure tvtropes.org/pmwiki/pmwiki.php/Main/FollowYourNose has a long list you can peruse for specific instances
Haha, the Family Guy quote in the first paragraph literally uses "beckon"
 
 
1 hour later…
4:11 PM
hey @roganjosh would you send me a private message here so we can talk, when you're available? (don't know how to do it)
this is Pedro btw
 
Hi everyone, need some help dealing with list values , basically I am trying to update new values incrementally while maintaining the order of old values (this means if I encounter an old value again I shouldn't be changing the position of the old value but I shouldn't have duplicates either in the list). here is the MCVE: pastebin.com/689WCAq4
 
Do you actually want to work on lists or dataframes?
 
the "i dont wanna apply my brain for this" method - concat the dataframes in one go, drop all duplicates at the end.
(if it's a dataframe that is... i suppose miyagi's question first)
 
4:28 PM
can I convert this into a dataframe problem? the only issue I am worried about is that I have the first dataframe in that format where the order matters for the list based column and I have more than one of them where each of them is related to the other , I only have the option of playing around with the second dataframe @MisterMiyagi
 
also, general advice with dataframes, building dataframes/arrays incrementally is just about the worst thing you could do. dataframe appends are O(n) and can also cause memory fragmentation. Look to build them all at once, no looping or incremental appends.
 
ok that sounds bad @ParitoshSingh
 
@RaphX There's a solution to your problem... but overall, I'd agree with @ParitoshSingh, this seems like bad form.
 
should I then convert the dataframes into rows using the explode method? The only problem with this is I am going to get around 13 million rows(currently 0.2 M rows in the list form) and I need to visualize this on a BI tool
Is there a better way?
 
Here is a plain python way that is relatively easy to read/understand
game_list_tracker = {
    1428013: ['templerun', 'pokemon'],
}

game_list_new = {
    1428013: ['templerun', 'sudoku'],
}

for user_id, game_list in game_list_new.items():
    old_list = game_list_tracker.setdefault(user_id, [])
    for game in game_list:
        if game not in old_list:
            old_list.append(game)
if you can afford the memory, you can keep a set to test for existence in O(1) rather than using the list for existence testing.
then follow that up with prettify-ing it with a dataframe
 
4:40 PM
Another way: but I think it is slow due to apply:
   test_df.append(new_df).explode('game_list').groupby('userId')['game_list'].apply(lambda x:pd.unique(x)).reset_index()
 
@AnuragDabas will this preserve the order?
thanks! @piRSquared
 
@RaphX @AnuragDabas's proposed solution uses pd.unique which should preserve order.
 
yes also you don't need lambda pass pd.unique.....but you will get numpy.array instead of list
 
thanks everyone! @piRSquared@ParitoshSingh@AnuragDabas
 
5:23 PM
@piRSquared Might be worth pointing out that since Py3.6 dict is a convenient way to create order-aware unique sequences. It's basically an ordered list with set-membership testing/uniqueness rolled into one now. Just convert it to a list once everything has been inserted.
 
@lupus There is no such way to do it via chat unless you're a moderator (which I'm not)
 
is this not possible? array my_array=[1, 'Berta', Dog, Cat]
 
That's absolutely possible. It's not an array, though, it's a list. And it assumes that you have Dog and Cat objects
 
that's a list, don't call it an array ideally, but i mean, if you defined Dog and Cat ofcourse that's possible
which means my money is on - "i wanted to use the strings 'Dog' and 'Cat' but i forgot to quote them"
 
5:55 PM
@roganjosh OK, so it's an imperative rather than an invitation. But still, in "tell someone to do something" the "something" is always "come here/come back", right?
 
Yes. Always a command to move toward the object doing the beckoning (until I find a counter-example, because why shouldn't there be one?)
 
OK, thanks
 
01:00 - 18:0018:00 - 00:00

« first day (3947 days earlier)      last day (984 days later) »