« first day (3197 days earlier)      last day (1976 days later) » 
00:00 - 16:0016:00 - 00:00

16:00
Machine too heavy to move by pushing across the floor, but spools that have motion that doesn't simply shred a film to bits can create enough motion to rock the whole machine across the floor...?
So I know there's got to be a better way to do what I'm wanting. I'm trying to take a dict that I have keys (1-200) and average a range of them i.e. trying to average keys 120-180. Right now, I've got a for loop adding them all up, then dividing by the number there are
I'm sure there's some easy dict comprehension way to do this?
Although, admittedly, I am currently reading a Wiki article where apparently there are 1448 tape cartridges in a single device
@roganjosh rocking takes much less force to move something
@biggi_ Like statistics.mean(val for key,val in dct.items() if 120 <= key <= 180)?
Probably.
if you have a dict of contiguous integer keys you should also consider using a list instead
although the 1-basedness would lead to some coding annoyance, for the benefit of performance
16:06
I do have a dict of contiguous integer keys
except "brick in a washing machine" is everything but subtle :P
See, i can find ways to get stuff done, just sometimes not the best way :)
youtu.be/uYQBDhkBfr0?t=81 not much effort to wiggle things at all
you might say, rock and roll ;)
@biggi_ as in, a list?
16:09
pretty much! I don't really get the difference in a list and a dict for my use.
when you don't get the difference you need a list, probably
@roganjosh reminds me of this youtube.com/watch?v=dAXa3wTZjes
Just watch out with 1-based vs 0-based indices. What you said suggests you have the former in your dict, but sequences in python index from 0.
slicing a list would be much more efficient than iterating a dict
I was thinking that. I just thought a dict would be the way to go, I'll covert over to list and slice it that way :)
16:11
any ideas on how to convert this two lines of code into one? It's about setting a new column in pandas using other column's info pastebin.com/zr10pgtZ
Can you even create new columns with attribute notation? I thought that was forbidden.
it's a bad idea to do it, but pandas allows it, god knows why
I briefly remember fiddling with that. you can then assign an entirely differently column using the normal square bracket notation
with some funny consequences for code later on.
idr what order you had to do it in, but essentially, one really shouldn't do it
@reydonsancho I suspect .apply won't mutate your input, just return a new column. So what you have now will probably not work, but if you move the .apply one row up and assign that into the dataframe as a new column, it will. But I haven't tried it myself.
@reydonsancho
df_final['ES_BARRIL'] = df_final.FORMATO_DESCRIPCION.str.contains('BARRIL').astype(int)
When I'm done with this, I should keep my original vs the help you all give me and then you should post it as a "we helped this weirdo....we can help you too!"
16:14
and yeah, I was going to go on with saying that apply is probably unnecessary :P
@AndrasDeak You are correct (in that you cannot). If a column doesn't already exist, you're just adding an attribute to the object which is all sorts of useless.
16:31
@U10-Forward No, I'm cracking!
@roganjosh I'm pondering if this is really asking for a tech solution to it or just have a file that'd uneditable or something...
@piRSquared shouldn't that be .contains('BARRIL', na=False) so the .astype(int) can't fail?
@JonClements I was tempted to prompt you to hammer with my dupe, which would probably be unreasonable, but it frames my interpretation of the question
yeah... I was tempted by your suggested dupe, however, it's somewhat *nix specific
@piRSquared perfect (well, no), thanks
@JonClements well, let me test it on Windows and see :)
16:37
@roganjosh well... it just doesn't make much sense what they're asking... on any multi-user/privilege system, a file can be read-only to someone/something and writable by others anyway...
also, it'd be quite amusing to try and run that program more than once on an account that has sufficient privileges to deny itself write access to a file it's created... but oh well...
Part of me thinks of Paristosh's (I think) suggestion of making my CSV an SQLite DB on the shared drive so that people don't touch it inadvertently
@X4748-IR That's not a Python question... But anyway, Windows accepts paths using forward slash. IIRC, even versions of MS-Dos before Windows existed did that.
That would be a lot more effective than a superficial block
99% of my messages are off-topic I think lol
16:41
df_final.FORMATO_DESCRIPCION = df_final.FORMATO_DESCRIPCION.astype('str')
df_final.ES_BARRIL = df_final.FORMATO_DESCRIPCION.apply(lambda x: 1 if 'BARRIL' in x else 0)
@JonClements hey, you volunteered for this position of making decisions :P But, one approach is just to let it ride. My dupe is posted and we've both added notes. I think it's unlikely to attract the swarms of crap answers because of the way it's phrased
@X4748-IR don't you see any issue with that?
@AndrasDeak Eventually used this approach
@reydonsancho why?
@piRSquared this broke due to nan values
16:43
@reydonsancho I suspect there should be a simple apply-less solution
not sure how to handle the nan exception with this df_final['ES_BARRIL'] = df_final.FORMATO_DESCRIPCION.str.contains('BARRIL').astype(int)
10 mins ago, by Jon Clements
@piRSquared shouldn't that be .contains('BARRIL', na=False) so the .astype(int) can't fail?
It was about all OSs and a reaction to an unrelated answer which was accepted.
I've been trying not to send off-topic things here, so I do see some issues!
@EduardoGutierrez So you're saying that your actual df actually does have lists of strings, and not just strings that look like lists? Interesting. If you can provide another MCVE that creates the data in that format, I'd be happy to play around with it some more. It might be a little trickier this time to make an MCVE since I don't trust pandas to serialize to csv properly, but I have faith in you :-)
@X4748-IR perhaps you shouldn't be complaining here about ways you think you were wronged in completely off-topic questions, hmm?
16:48
@roganjosh what can I say... I'm a masochist? :P
@AndrasDeak Missed that one! @JonClements working! Thks!
@AndrasDeak You are the admin. That's what you say.
Mind you... have never quite worked out why what just seems like a function that screams by its name "I return boolean results" - well, doesn't
... pandas
@Kevin I think you have it in the pastebin....so you only have to execute every pass in notebook in order....you only need also to download the stop words from pypi in the link i also provided... if you need anything more.....
16:53
Does anyone know how can I access a property of the class in a thread?
In [3]: s = pd.Series([1, 'test', 'x'])

In [4]: s.str.contains('e')
Out[4]:
0      NaN
1     True
2    False
Suppose that makes sense though
@EduardoGutierrez The pastebin, as in pastebin.com/Cz5jE4H2? That's not quite an MCVE because it crashes on the first line with NameError: name 'df' is not defined
@Kevin : almost i tried to have a list of strings from step 3.2.. where i get all the words that are not in a stopword list... so i return a list of words(strings) that are "correct" not belonging to the stopwords list
So, the difference between it not containing something and not being able to contain something...
@Kevin df is the dataframe .....only load from file i passed
16:55
And it can't be the case that I'm supposed to create the dataframe from the csv you uploaded, because the entire problem is that the df I constructed from your csv isn't in the same format as the df you actually have.
@Kevin : import locale

locale.setlocale(locale.LC_ALL,'es_ES.UTF-8')

pd.set_option('display.float_format', lambda x: locale.format_string('%.0f', x, grouping=True))

df = pd.read_csv('../data/raw/twitter_data.csv')
@Kevin: sorry my bad english....you would load a df who has df['tweetText'].. and from there applying every step you should arrive easily to have df['Tweeter_stopped']
@EduardoGutierrez I gave up on the question because it's in pieces across multiple files and your pandas config just there suggests to me that pandas just isn't right for this task
class Sample():

   stop_threads = False

   def SampleFunction(data):
      if self.stop_threads: return
      self.SampleFunction(data)

   def runThread():
      t = threading.Thread(target=self.SampleFunction, args=(5,), daemon=True)
      t.start()
I can't read stop_threads in SampleFunction...
@roganjosh : sorry my english is not very good, thanks for your help....
pandas likes to subvert your expectations
17:02
@EduardoGutierrez I'm getting pretty confused... So I need the csv and some file on pypi and the code in your pastebin and the code in this message and the code from one of your previous messages, and I need to guess what import statements I need because I can already tell that pd.set_option isn't a builtin. This is kind of a lot.
but honestly, once you get used to it, you know what pitfalls to avoid and it generally gets easier to work with
atleast, that's my experience with it so far
@ParitoshSingh you mean like they should probably bother breeding? :p
rofl, i think they should! and they should stay away from humans
What I need is a single file which I can copy and paste into an empty document, and run, and see the problem you have. I don't trust myself to assemble all of these different snippets into something functional. I already tried that and it turned out my dataframe didn't match yours.
@Kevin: the only thing you need is the 4 lines of code i posted above, to load the file into df.... i thought this was trivial.... then you should get a df with about 500 tweets...and a df['tweetText] which has the dirty tweet
17:05
Kevin is basically asking for an MCVE as if he was Canadian.
can you, in 1 message, give someone everything they need code-wise?
@EduardoGutierrez It isn't about your English (I understand you fine). It's about making something easy for us to run and work on
from there you only have to follow the steps in a notebook...first of all count words ( i think that are chars as you) and follow the process
Right, and you can see that we've not found it all that simple to do. We need a single example, in one file that implicitly says "JUST RUN THIS" and we can all see the issue
@X4748-IR the error is not "can't read stop_threads", is it? It's a NameError on self, is it not?
you defined your instance method wrong
I am a simple man, so anything that seems trivial is actually something I can mess up a hundred different ways. I don't want to waste any more of your time by making suggestions that work on my machine and not yours. An MCVE is the best way to ensure that we're actually working on the same problem
17:10
5 hours ago, by roganjosh
import pandas as pd

df = pd.DataFrame({'a': [['hola','manolo','adios'], ['adios', 'pedro']],
                   'b': [[1, 2, 3], [4, 5, 6]]})

lst = df['a'].values.tolist()
out = ' '.join([item for sublist in lst for item in sublist])
vamanos potatos
That was my very initial stab. Note how you can just copy/paste than and run it. It even has the imports needed, the dataframe builds itself. As it transpires, it doesn't do what you want. But the whole thing is self-contained
I get the error in PyQt5 extended class. It returns:

QObject::connect: Cannot queue arguments of type 'QTextCursor'
(Make sure 'QTextCursor' is registered using qRegisterMetaType().)
Segmentation fault
@roganjosh ' '.join(df.a.sum())?
17:14
I tried it right now. It works correctly in a regular class!
11
A: QObject (QPlainTextEdit) & Multithreading issues

Rob HIt appears you're trying to access QtGui classes from a thread other than the main thread. Like in some other GUI toolkits (e.g. Java Swing), that's not allowed. From the Threads and QObjects web page: Although QObject is reentrant, the GUI classes, notably QWidget and all its subclasses,...

@X4748-IR At the risk of sounding like a broken record, an MCVE would be great
It appears you're trying to access QtGui classes from a thread other than the main thread. Like in some other GUI toolkits (e.g. Java Swing), that's not allowed. From the Threads and QObjects web page:
Exactly what I'm trying to do
@piRSquared it's not worth debating the content of that post now because it was an initial response to a problem that you can see has been unfolding for 5 hours. I just want an MCVE that we can actually solve
@X4748-IR Did you read and fix the obvious bug I mentioned?
@AndrasDeak No! Let me see...
17:17
So you're asking for help, and ignoring the help. What do you want here again?
Is there any difference in the length of time it takes Python to fetch the value of a class variable, e.g. self.var_name, and a variable used only in a class method? In other words are there any performance benefits to be gained by making a local copy of a class variable in a method of the same class to avoid looking up the class variable lots of times within the method? [I am using Python 3 in case that makes any difference.]
class Sample():
    stop_threads = False

    def sampleFunction(self, number):
        if self.stop_threads: return
        print(number + 1)
        time.sleep(1)
        self.sampleFunction(number + 1)

    def startThreads(self):
        t = threading.Thread(target=self.sampleFunction, args=(5,))
        t.start()


obj = Sample()
obj.startThreads()
This works fine...!
@mattst Attribute lookups are slightly slower than local name lookups. There are a couple places in Python's own source code that makes a local copy in order to be just a little faster.
@AndrasDeak You know. I think there was no problem with my instance method...
17:19
@mattst if you have a tight loop of 100,000's of calls, it may help to have it local, but it's irrelevant for other cases
@X4748-IR Then say that?
@roganjosh @kevin: i have done a notebook from scratch...how can i share ?? Drive ??
@k
oops
@X4748-IR this is different from your earlier code block. Here the instance method is defined correctly.
@mattst you can edit/delete messages for 2 minutes
For example, consider random.sample, line 360: randbelow = self._randbelow.
17:21
Just looking at GA to ascertain whether I can do a job later, and wow, sopython.com is doing really okay
@Kevin @roganjosh Okay so the gain is tiny but can be had when a lot of look ups are done. Many thanks.
@EduardoGutierrez I guess Google Drive is fine. I usually prefer pastebin but I take what I can get.
@AndrasDeak Thanks. :)
I think in the first one there wasn't any instance at all...! Was there? I'm not sure what you mean by instance but this one is an instance for example:
t = ClassName()
And at the first one, I only made an instance of the threading module
@X4748-IR I didn't say instance. I said instance method.
24 mins ago, by X 47 48 - IR
class Sample():

   stop_threads = False

   def SampleFunction(data):
      if self.stop_threads: return
      self.SampleFunction(data)

   def runThread():
      t = threading.Thread(target=self.SampleFunction, args=(5,), daemon=True)
      t.start()
17:24
@JonClements GA?
By the way, I wrote that code without IDE. It was just an example. I think the problem is the class is a thread itself somehow...!
google analytics
Oh, Google Analytics?
you have to put away your assumptions when debugging, especially assumptions that make you ignore help from tohers
@Kevin Nicely sourced, and impressively quick, reference to the random code. Thanks.
17:24
@X4748-IR "just an example" that has a different bug than your real code is worse than no code. Seriously.
@AndrasDeak who's "tohers"? :p
@mattst I just happened to have that page open from yesterday, when me and the boys were trying to figure out how sample worked :-)
@X4748-IR I'll just stop here because I have better things to do, but note that the others also have better things to do and if you keep wasting our time I'll stop you
@JonClements all the ehlpful people here
Huh, SOPython tends to get corrected for me, so I'm suprised it gets hits. What's searchable content on it for someone who doesn't know its existence?
17:26
It must be Salad links and code formatting from here
@AndrasDeak :D I see the problem now. You're right.
sry...
So, one last question. are you familiar with PyQt5? Don't you have any idea of my error?
I'm not familiar with PyQt5, but I am familiar with Tkinter, which also raises cryptic exceptions when you try to modify attributes of a window element from a thread other than the thread that created it.
I thought the code that I sent will be the simplified version of the real one... I forgot to add self argument to methods...
17:30
@roganjosh actually a lot of stuff is /canon hits... so, something's being found and and indexed - if it was commercial it'd be a failure, but a few thousands hits a week and 800ish unique users is pretty darn good for what it is :)
@Kevin Hmmm
The typical solution is to create a queue which is used to send UI update requests from child threads to the UI thread.
@JonClements wow, that's way higher than I thought we were talking here.
huh...it seems that someone made my very exclusive ignore list at some time in the past...
@Kevin So how do you stop threads?
What I wanted to do is stopping threads...
17:32
I was a little confused why I could only see half of a conversation...and reply links weren't working, either.
I added a property (stop_thread) to check it in my threads. So when It's true threads have to stop
@Kevin Hmm...
I think I'm misunderstanding something. Didn't you just say that your code at chat.stackoverflow.com/transcript/message/46801713#46801713 works fine? I thought this PyQT thing was a separate problem.
@Kevin Yes this one is working. But I have the same thing in PyQt and It doesn't! I:
@Code-Apprentice It's been a confusing couple of hours, but not down to one person
PyQt's class is extended. I think maybe it creates a new thread for itself...
17:36
Well, if PyQt is anything like Tkinter, it works by entering an event loop that doesn't terminate or return control to your code until the user closes the window. That might explain why if self.stopped: return isn't doing anything: because PyQt's mainloop is blocking indefinitely and if self.stopped: return isn't getting a chance to execute
@X4748-IR Well, it kind of works. Until that method tries to recursively call itself for the thousandth time... Actually, it'll crash a little sooner, since the call stack doesn't start out empty.
I have all of those which I sent you in my Ui_MainWindow class
@X4748-IR I must have missed that link. Can you send it again?
@Kevin No it works! But suddenly when I change the value of stop_threads to True the main window is being closed
@JonClements someone has since suggested a DB on the read-only CSV file question, and another close-vote :)
17:39
And console returns the error that I sent
@Kevin To be clear It's like this following code, the real one I mean:
@JonClements is that sopython.com visitors?
I will be happy to investigate this problem further, as soon as you can provide me an MCVE. Until then, I'm off to look at memes
17:42
I'd personally have expected a few hundred a month or something, but while it's not massive figures, it's nice to see it has worked and be appreciated
Kudos to David for getting it going and everyone that contributed content to it :)
Ok, seriously, is there a Google search term that will pull up SOPython above anything else? What exactly is pulling this traffic?
27 mins ago, by Kevin
@X4748-IR At the risk of sounding like a broken record, an MCVE would be great
Because, if it can generate traffic in its own right, then we can perhaps work on making that better
@X4748-IR Kevin's told you twice to cough up an MCVE. Go away and create a good one before you come back.
class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        ....

    # Threads
    stop_threads = False

    def TryPasswords(self, data):
        if self.stop_threads: return
    self.TryPasswords(data=data)

    def startAction(self):
        if self.start.text() == 'start':
                # Start Threads
                for i in range(self.horizontalSlider.value()):
                    t = threading.Thread(target=self.TryPasswords, args=(data,), daemon=True, name=str(i + 1).zfill(2))
17:43
@roganjosh i add SO at the end of all of my questions on google if i want an SO hit. it doesn't always bump it to the top though
but works fairly well and gets me the results in the top 3 in any case
@ParitoshSingh SOPython, the community site
@roganjosh ^^^ mostly organic it seems
oh, hmm.
mb, i have no idea how to get to SOPython from google :P
By searching for "sopython" and getting corrected by Google for it :P
It will start threads if the button is equal to 'start'
And if it's equal to something else it changes the value of stop_threads to True
17:46
Don't some web hosts have a way to see what users have entered into google in order to get to your site? That would be useful.
@AndrasDeak Ok...!
I must remember to ask davidism about that the next time I see him. Right now he's sleeping under a mountain, until our day of greatest need.
umm... GA does that anyway @Kevin you can see the queries that brought you to the site thingy
mind you, they've changed the interface so much I'm struggling to find it
Oh, is it publicly available? That's surprising to me
oh, it's not publicly available, it's just to the site itself
17:49
Makes sense.
gotta rbrb for a bit... so rbrb
I read about MCVE! Hmmm, Don't you mind if I produce the inside the Qt's class?
@JonClements FWIW, sometimes when I hammer questions I've occasionally written a comment that links to the sopython canonical question page when that page has a good summary of the problem. But I don't expect that that generates a lot of traffic.
@X4748-IR we don't mind an MCVE if it's an MCVE. And use a code paste service rather than posting directly here.
17:53
I tried to make an MCVE before. But it doesn't return the error ...
if it contains unnecessary fluff, or it doesn't reproduce your issue, or it produces different issues, or it isn't self-contained: it's not an MCVE
@X4748-IR If you're saying "do you mind that some of my classes inherit from pyqt classes?", no, I don't mind. I already have pyqt installed, so that's not a problem.
@AndrasDeak Ok... Thanks.
@X4748-IR then you're missing the C
Sometimes the process of creating an MCVE gives you enough insight to solve the problem for yourself (madness!)
17:54
take your code, start removing unnecessary-looking bits and monitor that the issue is still present and the remaining code is still self-contained
if the issue goes away: put stuff back and remove some other unnecessary-looking things
@PaulMcG +1 I hope the same thing happens...
I'll try. I made the code using qt creator. You just make a UI in there and then you can create your functions...
pyqt5-dev-tools
sounds like a pain to debug if you don't know what you're doing
What do you all mostly use for writing/debugging your Python? I've been in VSCode and it seems to work fairly well.
I'm a luddite so I write code in vim and debug it with pudb (if necessary)
Spyder and brute-force
17:59
Now I'm guessing that you were not in fact saying "do you mind that some of my classes inherit from pyqt classes?" and you were saying "do you mind that my classes were constructed using the proprietary qt window UI creator tool?". In that case, I might mind, depending on whether or not you expect me to also use the proprietary tool in order to see your problem.
I use vim a lot for my embedded stuff
Used to use Sublime
@Kevin I suspect it's a tool that lets you draw boxes and buttons in a window, then generates a template for that which you can edit later. So the end result is python code, but it's long and partly machine-generated.
Long and machine generated isn't a dealbreaker. In my infinite mercy, I will accept MCVES that are not completely minimal.
@Kevin :D Ok... I'll try to make it simple. Just one single slot and signal
BUT make sure first that it's self-contained as-is and that it reproduces your problem and only your problem!
18:02
@AndrasDeak Exactly
The result is an XML file. you can convert it to any other language that you want
otherwise I will strike down upon thee with great vengeance and furious anger
M, I can take or leave. CVE, I can't do without
@X4748-IR python, we want python
Yes Python please
If you're thinking "surely you'll be able to convert the XML into Python on your own?", scroll up and read my "I am a simple man" message again.
irrespective of the complexity of Kevin as a man I will not accept XML as a medium for a python MCVE
18:04
Kevin is pretty complex
the i in Kevin is actually sqrt(-1)
Simple and complex, like the Mandelbrot set
@AndrasDeak Is he imaginary? A projection of collective conscience?
I am a strange loop
@roganjosh I never said that Kevn is real
18:09
You'd make a good politician with your omission
cabbagaes all, from NYC!
cbg :)
@Kevin @roganjosh : the notebook drive.google.com/open?id=1teGHw01Bd5AfAarZI3OauA2D25o-MSkS and the csv file drive.google.com/open?id=1qEyZ6sKK98vPDl_9g2sV9maGM_jcY2E_ ... you only have to change the read_csv path ....
time for some major news: I now work for g4dgetcorp
18:10
I'm like an electron cloud, I orbit around the same position all day but you can never pin me down exactly
... and for the purposes of right now, g4dgetcorp is Roku
@Kevin that reminds me io9.gizmodo.com/…
@inspectorG4dget Nice :-)
not very relevant, just neat
@inspectorG4dget congratulations :)
many thanks, my peoples
also, this now means that I'll be more more active on here
18:13
@EduardoGutierrez I'll take a look, as soon as I figure out how to run a notebook file
@Kevin I'll try convert it for you. In theory, Spyder should be able to open it but I'm on a major release beta
So far, it's crashed. All going well :P
I give up. I'm not going through that. I've got bored of all this.
It's an inalienable human right to quit looking at a problem and go browse memes instead
lol
It's easy to understand...
He's replying to my comment
18:23
There are just 2 functions that I've created there...
Yes... But I also reserve the right for myself for other problems :-P
@Kevin @roganjosh : the notebook saved as python file .... hope it can help... pastebin.com/wp0h5vqV
@roganjosh Ouw...!
@Kevin sadly, it's an inalienable human problem to be unable to go to sleep, thinking about that problem
18:27
@X4748-IR Ok, definitely looks like a "you're not supposed to call textBrowser methods in a child thread" problem.
In this case, it won't trouble my sleep. In both cases that are colliding now, I don't think either person has made it particularly easy this evening to help out
@Kevin It's being closed after a few seconds... If there was such that problem shouldn't it just stop the code from running?
It even prints numbers in textBrowser...
It doesn't close on my machine. On my machine, the window freezes and I get a popup saying "python has stopped responding"
@Kevin Hmmm...
I've heard daemonizing doesn't work on windows machine
I'm using Gnu/Linux - Ubuntu
@kevin @roganjosh÷ pastebin.com/YFKe1B3h.. Here is the problem, you cant see very clear...review is looping but textcleaned only stores the last words...not all the words....
18:36
@EduardoGutierrez please don't ping me any more about this
If this was tkinter instead of PyQt, I could write up a solution in thirty seconds using widget.after_idle... There doesn't appear to be anything like that in PyQt.
@Kevin ):
18:41
There is no need to be sorry. Hopefully you've posted something that can be answered now, but I have a limited working memory and I'm not sure I can be helpful when the problem goes through so many iterations. Hopefully you can be clearer on the first few posts.
I'm sure Qt has something to solve this problem. Qt is an advanced framework. But I can't find the solution, unfortunately.
I'm sure there are a half dozen solutions in the post you linked, I just don't know how to implement any of them with my thirty minutes of Qt experience.
I bet doc.qt.io/archives/qt-4.8/threads.html contains several nuggets of wisdom. I don't really feel like sifting through twenty pages to find them though.
@Kevin It's a little hard to read Qt's documentation because it mostly supports C++ version of Qt. At least I don't understand documentations that much
@EduardoGutierrez Well, of course textcleaned only stores the last words. You're creating the value inside the loop, and it depends only on the state of the current row being looped over. In every loop you're completely discarding the previous value of textcleaned. There's no reason to expect it to accumulate the whole text of every tweet, or anything.
If you want a list of all the words, I don't see why you can't just do:
all_words = []
for review in df['Tweet_stopped']:
    all_words.extend(review)

print(len(all_words))
No need to muck around with " ".join or anything.
@kevin because im getting a list of strings ...and i need a text with all the words inside a single string.... ( im using wordcloud to draw the result)...and as input parameter is a string not a list
18:57
Ok, you can have a single string of words if you want. But len isn't going to tell you how many words are in that string.
Well, whatever. I'm assuming that you don't really care about len and were just using it as a sanity check to confirm that your collection of words got smaller after filtering. If a single string of words is your ultimate goal, then go ahead and do filtered_text = " ".join(all_words).
datacamp.com/community/tutorials/wordcloud-python im following this tutorial adapted to my tweets....i think we got an error the len...len is taking about chars and not words as you said before
As was said nearly 7 hours ago
print(len(all_words)) works perfectly on my machine. If you constructed the MCVE right, it should work perfectly on your machine too. As far as I'm concerned, the problem is solved.
len is not important the imporant is to have a string with all the words separated by space and repeated ... so wordcloud can do its job..... "tv3 pedro pedro manolo juan tv3 ....."
wim
wim
why is "git pull" a shorthand for fetch + merge? wouldn't it be better if it was a shorthand for fetch + rebase?
19:06
I guess Linus thought that the history-preserving one should be default. Plus when you push something, you expect it to be merged on the other side, right?
if pull requests usually merge then it would be weird if pull rebased
wim
wim
acceptable explanation.
One quick question about reg:  text = re.split('\W+', text)
i use that to tokenize ( split text into words) ...but i notice that @tv3 is changed to tv3 and so with #pepe is transformed in pepe
as im interested in keeping usernames and hashtags in a tweet is a way to avoid this ? works perfect except id like to preseve wods that being with @ and # ....
wim
wim
why not just text.split()
well ive read is more reliable \W+ but dont know...
wim
wim
well you just said @ and # should not be split
those are in \W class
19:26
Proposal: split on whitespace characters (via \s) rather than splitting on nonword characters
wouldn't that just be an elaborate text.split()?
ah, no, str.split() only does spaces, right?
Hmm, I don't know.
  None (the default value) means split according to any whitespace,
  and discard empty strings from the result.
nope
The shoulder angel of robust design is whispering to me that one ought to use a proper Natural Language Processing library for this kind of thing.
I have decided that this is actually the shoulder devil of overcomplicated design, and I have unloaded a can of bug spray in his face
But yeah, if you're not using NLP, may as well just use str.split()
wim
wim
mushroom mushroom
wim
wim
20:25
slow day at work? :P
 
1 hour later…
21:53
Does anyone know how I can kill a thread? I need a simple answer. I googled, but I didn't understand anything.
22:12
If it's coming out of your sweater, use fingernail clippers.
wim
wim
the simple answer is you can't
the thread has to want to die itself
that's dark
wim
wim
it gets darker
the good solution is to have the thread periodically ask itself the question "should I kill myself?" (checking some state, for example)
if you need cleanly killable workers you are better off to use multiprocessing not threading
22:33
@X4748-IR I assume this is for your PyQt program, where you want all the worker threads to die simultaneously. Just have the thread periodically check some attribute to see if it's time for it to terminate.
And you really should get rid of that recursive loop. They aren't a good idea in Python.
check if there's a horse's head in its bed
@PM2Ring You're right. I removed that line. I changed it to while True.
@AndrasDeak Coincidentally, The Godfather was mentioned a few hours ago in The h Bar, in a conversation about gangster movies & TV shows.
@X4748-IR Oh, good.
@X4748-IR And you might not even need to use the threading module. GUI frameworks normally provide ways to run tasks in a way that cooperates with the main event loop. I don't know Qt, but it's easy in GTK & Tkinter. OTOH, sometimes there is a legitimate need to use threading with a GUI program, but it's best if you can avoid it unless you really need it.
22:44
@PM2Ring I don't stop threads anymore... I changed "Stop" button to "Close" button lol
This one looks good too. But it would be better if it was stoping threads
I was exploring the use of threading with Tkinter a year or so ago, mostly just as an exercise to see if I could make it work properly. I discovered a few interesting timing quirks in the process, but got it working to my satisfaction. Then a few days later I realised I could get almost exactly the same functionality without threading, and reduced the program size to about 1/3 of its previous size. :)
+ I love recursion for some reasons, but it seems there is no other choice
@PM2Ring I don't like Qt's documentation. It doesn't explain modules/libraries/calsses clearly.
I think Tkinter is being used more than pyQt.
@X4748-IR In some languages, tail call recursion can be optimized. Python doesn't do that, and it has a limit to recursion depth. You can adjust that limit, but there's rarely a good reason to do so, and the limit is handy when a buggy program wants to recurse indefinitely, eating up all your RAM and CPU time. So just use recursion when it makes sense, like processing a recursive data structure.
also overflowing the stack
@X4748-IR Maybe. Qt is a fully featured GUI framework, with a large learning curve. Tkinter is less capable, so the learning curve is a lot smaller. And although it's not as powerful as Qt or GTK, it can still do a fair bit, although people do complain that Tkinter GUIs aren't as polished looking, and can sometimes feel a bit clunky.
But it's a good beginners' GUI, IMHO, and it teaches you the basics of event-driven programming.
@X4748-IR I haven't looked at the PyQt docs, but if they're anything like the old PyGTK docs, they assume that you are already a competent coder in core Python, and understand how classes & inheritance etc work.
@AndrasDeak Very good point; I kind of included that in "eating up all your RAM". :)
Are you worried you'll get Qts from it?
@PM2Ring They're so short/summarized...! It just says, yes this a slot, this one is signal... that's all you need to know :D
(I'm aware that neither Q nor t are pronounced that way)
though it supports C++ nicely. but for pyqt and similar things, it's not that easy to understand...
@wim lol
wim
wim
at WimCorp there are some apps that, for stupid reasons, are desktop apps .. and they really would be better off being webapps
23:13
Legal "code needs to be verified by a committee of sages" reasons or other?
The code needs to be verified by clients! Those who don't understand anything about programming and want to use your app lol If they say it's something good it means it's great
00:00 - 16:0016:00 - 00:00

« first day (3197 days earlier)      last day (1976 days later) »