I am trying to split the strings in a column tweet_text if the column lang is en Here is how to do it on a string: s = 'I am always sad' s_split = s.split(&quot; &quot;)  This returns: ['I', 'am', 'always', 'sad']  My current code which does not work: df['tweet_text'] = df.apply(lambda x: x['tweet_text'].split(&quot; &quot;)  if x['lang'] is 'en' else x['tweet_text'], axis = 1)  Dictionary of data: {'lang': {1404: 'en',   1943: 'en',   2169: 'en',   2502: 'de',   3981: 'nl',   4226: 'en',   7223: 'en',   8557: 'de',   11339: 'pt',   11854: 'en'},  'tweet_text': {1404: 'I am always sad when a colleague loses his job and Frank is not just a colleague he is an impoant person in my',   1943: 'It remains goalless at FNB Stadium between Kaizer Chiefs and Baroka at halftimeRead more',   2169: 'Which one gets your vote 05',   2502: 'Was sagt ihr zu den ersten Minuten',   3981: 'En we gaan door speelronde begint vandaagTegen wie speelt jouw favoriete club',   4226: 'Quote tweet or replyYour favourite Mesut Ozil moment as a Gunner was',   7223: 'How to follow the game live The opponent Current form Did you know The squad Koeman said It must b',   8557: 'BAYERN BAYERN BAYERN BAYERN BAYERN BAYERN BAYERN BAYERN BAYERN BAYERN BAYERN BAYERN BAYERN BAYERN BAYERN BAYERN',   11339: '9o golo para',   11854: 'have loads of boss stuff available on their store products available including the m'}}
My  has failed me.  In Python, are the following two tests for equality equivalent?  n = 5 # Test one. if n == 5:     print 'Yay!'  # Test two. if n is 5:     print 'Yay!'   Does this hold true for objects where you would be comparing instances (a list say)?  Okay, so this kind of answers my question:  L = [] L.append(1) if L == [1]:     print 'Yay!' # Holds true, but...  if L is [1]:     print 'Yay!' # Doesn't.   So == tests value where is tests to see if they are the same object?
What is this noisy shadow overlay that stays with the camera? leaflet geojson coordinate problem I just started to play with leflet/geojson a little. But my coordinates are not rendered properly and I have no clue what is going on.  My coordinates are: 52.23943, 4.97599. They work correct with the setView function.  var map = L.map('leaflet_map').setView([52.23943, 4.97599], 15);   But using a geojasonFeature they are, hmmm, 'projected', somewhere east of Somalia.  var geojsonFeature = {             "type": "Feature",             "properties": {             "name": "Coors Field",             "amenity": "Baseball Stadium",             "popupContent": "This is where the Rockies play!"             },             "geometry": {                 "type": "Point",                 "coordinates": [52.23943, 4.97599]             }         };         var myLayer = L.geoJson().addTo(map);         myLayer.addData(geojsonFeature).bindPopup("I am a gjson point.");   Anyone who knows what is happening here?  EDIT  Out of pure curiosity I changed the coordinates around [4.976143930893815,52.23925499011473] and the point appears at its correct location. A known bug!? A long time ago, I remember hiding some really personal files on my computer. Something that nobody could ever find, so I buried them down pretty darn good.  Now to my problem, I don't remember where.   Do anyone know a way to scan a drive and list all hidden folders and/or files?   I know how to view hidden files in Windows, but as far as I know, there is no way to search for them? I've been looking for a program, but I couldn't find one - and now I'm here, asking the experts. ;)  I'd really appreciate any tips. What are a few examples of noncyclic finite groups? I just want to make sure that every group $\mathbb{Z}_n$ for any $n$ is cyclic. Further, every group of prime order is cyclic because it is isomorphic to $\mathbb{Z}_p$. I think I have a handle on that, but what other finite groups are there that aren't cyclic? In particular, I'm looking for examples that aren't direct products of groups, just simply groups like $\mathbb{Z}_n$, not $\mathbb{Z}_a \times \mathbb{Z}_b$, etc. Using Newton's method calculate $ \frac{1}{\sqrt{a}} $ without division Suggest algorithm for the numerical calculation $ \frac{1}{\sqrt{a}} \ a &gt; 0 $ without division, use Newton's method.  My idea is:  $$ \frac{1}{\sqrt{a}} = (\sqrt{a})^{-1} = a^{-\frac{1}{2}}$$ $$ x = a^{-\frac{1}{2}} \Rightarrow f(x)=x^2 - a^{-1}$$ And next step is calulate $ f'(x)=2x $, but after substitution I got: $$ x_{n+1} = \frac{x_n^2+a^{-1}}{2x_n}$$ And know I still have divion, I guess. Maybe you've better idea on this task? I saw this question: .  My situation is a little different though.   My target moves, and the shooter moves.  Also, the shooter's velocity is added to the bullets' velocities, i.e. bullets fired while sliding to the right will have a greater velocity toward the right.   What I'm trying to do is to get the enemy to be able to determine where they need to shoot in order to hit the player.  Using the linked SO solution, unless the player and enemy are stationary, the velocity difference will cause a miss.  How can I prevent that?      Here is the solution presented from the stack overflow answer.  It boils down to solving a quadratic equation of the form:  a * sqr(x) + b * x + c == 0   Note that by sqr I mean square, as opposed to square root. Use the following values:  a := sqr(target.velocityX) + sqr(target.velocityY) - sqr(projectile_speed) b := 2 * (target.velocityX * (target.startX - cannon.X)       + target.velocityY * (target.startY - cannon.Y)) c := sqr(target.startX - cannon.X) + sqr(target.startY - cannon.Y)   Now we can look at the discriminant to determine if we have a possible solution.  disc := sqr(b) - 4 * a * c   If the discriminant is less than 0, forget about hitting your target -- your projectile can never get there in time. Otherwise, look at two candidate solutions:  t1 := (-b + sqrt(disc)) / (2 * a) t2 := (-b - sqrt(disc)) / (2 * a)   Note that if disc == 0 then t1 and t2 are equal. User deleting code after question has been answered If a user keeps  (thus making the answer meaningless), what should we do? Rollback the edit (what if the user just deletes the code again)? Delete the question?  More examples (same user): ,  (see also edit histories). Suppose I have a dataframe consisting of six time series. In this dataframe, some observations are missing, meaning at some timepoints all time series contain a NA-value. In R, one possible imputation package that can be used to impute time series data is Amelia. However, this package does not work for observations that are completely missing. Are there other ways to impute my data? For what it's worth, the amount of missing observations is less than 20% of all observations. How to persistently control maximum system resource consumption on Mac? Before Mavericks, I could use /etc/launchd.conf file to change maximum system resource consumption, for example:  limit maxfiles 16384 unlimited limit maxproc 16384 unlimited   It no longer works in Mavericks.  What is the correct way to do it in the recent version of OS X? Directory size calculation difference I need to get the size of directory in terminal for signing purposes. I'm using following command:  du -s /path/to/dir   I'm multiplying the result by traditional UNIX block size (512 bytes) and get actual directory size in bytes. However, the Finder's "Get Info" dialog window shows the size slightly smaller than the one calculated with the terminal command. And it seems that it's reproducible on any folder/bundle. What am I missing? Can I open a US bank account even if I don't live in the country? Why does the /boot partition get updated when I install software Based on some recommendations I read online, on install of a new (Ubuntu) system, I made my /boot partition separate from / and small in size (only around 50 MB). It makes sense to me that you would only need limited files in that partition, and the boot sequence only needs so much data initial data on boot so no need (or so goes my thinking) to make it much larger.   I was surprised as I started using my system and installing software was failing due to the following (or similar) issue:  gzip: stdout: No space left on device cpio: write error: Broken pipe E: mkinitramfs failure cpio 1 gzip 1 update-initramfs: failed for /boot/initrd.img-3.2.0-18-generic with 1.   I have already seen  and am planning on doing a reinstall with a larger /boot partition. My questions are:  Why does the /boot partition data get updated when I am only installing software?  obviously 50 MB is too small for my needs, so what would be a reasonable /boot partition size?  Does it even make sense to have separate boot partition? after all it could simply use all the disk space it wants in the / partition. Classify orbits of conjugating action on $GL_2(\mathbb{C})$ Why draw blood from veins rather than arteries? Why draw blood from veins rather than arteries? Is it more convenient or safer? How to connect to Office Online Server in Office365 I just wondering if we can use existing Office Online Server in Office365 for SP2013 on premise. If yes, how this can be achieve?   In SP2013 we normally run Get-SPWOPIBinding to find out the server binding and to connect to Office web App we normally run  New-SPWOPIBinding -ServerName. Is this the same command if I want to connect to the existing new Office Online Server in Office365?  Thanks I need to prove that if $f: (0,1) \rightarrow \mathbb{R}$ is Uniformly continuous then it is  bounded.   Thank you. I read about Drupal behaviors today, and I tried writing the following code.  (function ($) {    Drupal.behaviors.mymodule = {     attach: function (context, settings) {       $('#mymodule_id', context).change(function () {         alert('Handler for .change() called.');       });     }   };  }(jQuery));    Is Drupal.behaviors.mymodule the namespace? What are the context and settings parameters passed to the Drupal behavior? Is this the equivalent of document.ready()?   Can I attach any number of functions?  Can I define JavaScript functions which will be called somewhere? Interpretation of ROC curve The verbs dare and need do not require auxiliaries when used in the interrogative; for example, “need I?” is as acceptable as “do I need?”  Excluding the auxiliaries themselves (like be, do, have), are there any other such verbs that work that way? Windows 10: Pin an item to left side of Start Menu?