So I have a dataframe that has the date of birth written as a string '2012-07-06T21:00:00.000Z' (example). I want to calculate the users' age from that. Note that this is a string and I think I need it to be datetime to be able to calculate it. Thank you much my code (Python): def calculate_age(born):     born = datetime.strptime(born, &quot;%Y-%m-%d'T'%H:%M:%S.%f%Z&quot;).date()     today = date.today()     return today.year - born.year - ((today.month, today.day) &lt; (born.month, born.day))  df['age'] = df['birth_date'].apply(calculate_age)
I need to parse  strings like "2008-09-03T20:56:35.450686Z" into Python's datetime type.  I have found  in the Python standard library, but it is not very convenient.  What is the best way to do this?
Why should users never use normal sudo to start graphical applications? What does Use an Object cover? My multimeter is rated to 600V.  How can I readily (and safely) use it to measure higher voltages? Uniform Scattering with vector Creating label in QGIS? I am using QGIS 2.18.16 on Windows 10.    What I want is a label to appear within the boundaries of a polygon.    I select a layer, then select command Layer>Labelling, and I get:    From here, I can change "No Labels" to "Show labels for this layer".  But I can't actually create label text.  I find a clue in a prior question:    “Labelling polygon using QGIS?”    The answer was:  The layer you are trying to label must have at least one attribute field populated with data. You can then turn on labelling in Layer Properties and select which attribute field to use for your labels.  I can enter command Layer>Open Attribute Table, and what I get is:    If I need something in the attribute table in order to apply a label, how do I accomplish that? Bolzano-Weierstrass Theorem Proof Abbott (Ax. of Choice) In Abbott's Proof of the Bolzano-Weierstrass Theorem, does Abbott use any form of the Axiom of Choice ?   I think he is since he chooses an $a_{n_k} \in I_k$ where there are multiple such $a_{n_k}$. What is wrong with defining \bal as \begin{align}? I'm trying to define two commands \bal and \eal instead of inserting \begin{align} and \end{align} in my document, but in the code below, I'll get some errors. What is wrong with it?    \documentclass{article} \usepackage{amsmath} \makeatletter  \newcommand{\bal}{%  \begingroup  \align% \@ifstar{\nonumber}{}%  }  \newcommand{\eal}{\endalign\endgroup} \makeatother \begin{document} \bal* x=y \eal ‎\end{document} Problems with Curve Modifier Every time I think I have the curve modifier mastered, it throws me a another curve ball (no pun intended).  Why in  can I not get the lights to follow the spiral curve? When the modifier is activated, the lights are stretched and distorted along the curve.  I created the curve by converting it from a mesh (string of verts). Why does it not display like a normal Bezier? Is that related to my problem?  I am following all the "rules" that I am aware of, as detailed here: . The curve seems to run in the correct direction. The origin point is at the first point of the curve. The curve modifier on the lights is set to -Y which is the local orientation of the curve's direction.  What am I missing? Can't format / delete locked partition from GParted? The title says it all. I want to resize windows with an right click while holding the alt key, instead of the new default alt+middle click.  I have found no way to enable this behaviour in 13.04. The gconf-Key suggested in this , doesn't seem to exist any longer. How to align right within equation array To find tangents to given circle from a point outside it Find the combined equation of two tangents drawn from $P(x_1,y_1)$ to the circle $x^2+y^2 = a^2$. Point $P$ lies outside the circle. I've just started using matlab-prettifier.    Since the line \begin{lstlisting}[style=Matlab-editor] is a lot to type, I created my own environment:  \newenvironment{myMP}      {\begin{samepage}\begin{lstlisting}[style=Matlab-editor]}      {\end{lstlisting}\end{samepage}}   I've used this syntax many times before, but in this case it doesn't work.  Is there any reason why I can't enclose the lstlisting inside my own one?  Here's sample code, illustrating the problem.  \documentclass{minimal} \usepackage[framed]{matlab-prettifier}%For matlab code \newenvironment{myMP}      {\begin{samepage} \begin{lstlisting}[style=Matlab-editor]}      {\end{lstlisting} \end{samepage}} \begin{document} \begin{myMP} matlab word \end{myMP} \end{document}   When I run this with pdflatex it returns a *, indicating that the environment wasn't closed properly.  Thanks! Historical reason behind different line ending at different platforms Why did DOS/Windows and Mac decide to use \r\n and \r for line ending instead of \n? Was it just a result of trying to be "different" from Unix?  And now that Mac OS X is Unix (-like), did Apple switch to \n from \r? Are the endings "-zation" and "-sation" interchangeable? What is with words that have forms that end both in -zation and -sation, such as localization and localisation?  Many spell checkers recommend -zation. $$\frac{1}{z-\sin z}$$ $$\frac{1}{z(1-\frac{\sin z}{z})}$$  the laurent's transform is also used to simplify the function.  the residue is found a $\frac{2*36*2}{5}$ but the actual answer is given as $\frac{3}{10}$ the residue is given as The solution is incorrect and also the pole is of the order 3. How to add citation for a whole paragraph? If I write a report and a whole paragraph is based on one source but not cited verbally it seems unnecessary to include the reference after every sentence:  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua (source 1). Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat (source 1).  Now I found a Phd thesis that puts the reference after the last dot of the paragraph to indicate that it is based on this very source:  Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. (source 1)  Is this a common practice? Is it generally understood? What are other ways to add the reference for a whole paragraph? What are the grammatical rules determining whether to use "which" or "what"? What are the grammatical rules determining whether to use which or what?  I usually go by intuition. It's "What car are you looking at?" and "What bicycle do you like most?" but "Which song did you sing?" Quite often, I don't know whether to use what or which.  How can I tell? How can I change the default "ens33" network device to old "eth0" on Fedora 19? Fighting a black hole: Could a strong spherical shell inside an event horizon resist falling in to the singularity? As a thought experiment imagine an incredibly strong spherical shell with a diameter a bit smaller than the event horizon of a particular large black hole.  The shell is split into two hemispheres, and the two hemispheres are released from either side of the black hole such that they will meet and join inside the event horizon, forming a stationary uniform shell around the singularity. Of course, we consider that the shell is flawless, and exactly centred around a stationary singularity - clearly this is an unstable equilibrium but we imagine it is possible.  Is is possible that the structural forces provided by such a shell could be strong enough to resist the extreme gravity conditions inside the event horizon, and hence avoid being sucked into the singularity?      (For the purposes of this question we can consider taking the shell to extreme levels of strength, e.g. consider that the shell is made from a theoretical maximally densely packed neutronium-like material that is strongly resistant to any further compression due to the Pauli exclusion principle).