<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 15 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
span.EmailStyle18
        {mso-style-type:personal;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link="#0563C1" vlink="#954F72"><div class=WordSection1><p class=MsoNormal>Changing horses mid-stream is not generally a good idea. But python is easy to extend so there may be other choices out there.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>The reality is that what matters more than what choices a language makes is consistency across the language. If you can learn the choices and even quirks and work with them, you can get things done. I have used languages where vectors or lists are zero-based and some where they are one-based. Both work, albeit you may need to adjust an algorithm to add or subtract one from the index you use or leave the first entry empty. If you use a pandas data structure without specifying your own index, you get stuck with the default behavior. If you wanted a 1 or 0 based index, you could add that carefully and so on. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>In theory, you could create an alternate numpy or alternate pandas just like many of the alternate modules you can find which  often have very different designs for graphics and there probably already are some out there. Integrating them with other tools may not be as simple. If you want to use the machine learning tools available, some functions demand they be given the data as a pandas DataFrame or a numpy array. Giving them something else like a python list, even if it is just an object extended from the above, may well break things.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>This makes it very hard to port some things to or from other languages with different design constraints as an algorithm that looks straightforward in one because it goes with the overall grain of the language may need major surgery to fit into the other and perhaps might best be rewritten using some other algorithm that fits better.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>A different discussion elsewhere about errors was instructive. Many programmers used to write complex code that checks for all kinds of errors or conditions. Some python programmers take an approach of expecting errors to be something you catch so why bother checking for things like an array index being non-existent. Well, if an error you expect in pandas is not caught, consider checking before using software that does not enforce it. And some “errors” are not errors. As mentioned, in R it is NOT a design error that using an NA value in a calculation silently propagates the NA. Throughout the language you must either check if there is an NA using the is.na() function or by telling routines to drop/ignore any NA as in sum(something, na.rm=TRUE). There are many design decisions you make this way. So, if your language does something you don’t want when it uses an implicit index, fine. Give it an explicit index. If it does not properly check the range you provide for validity, do it yourself. <o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>And if the language is so unsuitable for your needs, you can often switch. In particular, there are now even ways you can start your code in one language like python or R and then shunt some data structures across a divide where the other language can do things another way and if needed, shunt it back and repeat. That may not work well for your application and, as noted, switching rides in midstream has its dangers.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><b>From:</b> NumPy-Discussion <numpy-discussion-bounces+avigross=verizon.net@python.org> <b>On Behalf Of </b>Robert Kern<br><b>Sent:</b> Sunday, February 17, 2019 3:15 PM<br><b>To:</b> Discussion of Numerical Python <numpy-discussion@python.org><br><b>Subject:</b> Re: [Numpy-discussion] [SciPy-User] Why slicing Pandas column and then subtract gives NaN?<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>On Sat, Feb 16, 2019 at 8:42 PM C W <<a href="mailto:tmrsg11@gmail.com">tmrsg11@gmail.com</a>> wrote:<o:p></o:p></p><p class=MsoNormal>Dan,<o:p></o:p></p><p class=MsoNormal>No one here is trying to convince you to use Python. If you don't like<br>it, don't use it. <o:p></o:p></p><p class=MsoNormal>The problem is not me, it's the language. No need to take it out on me personally. I've used other languages, Python is lacking in this area. I'm being very frank here, just think about it.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>No one was taking it out on you personally. We're just stating that we're not interested in having a discussion about which semantics are best, much less convincing you that Python's choice is the right one. They have been that way for a long time, and the time for making those decisions is long past. We could not change them now if we wanted to. Empirically, I've been on these lists for about 20 years now, and I have not seen this pop up as a frequent issue causing bugs in real code, so I would submit that if there is a lack (or benefit) compared to other languages, it is small<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>That said, Python is not alone here. Perl and Ruby have Python's semantics. R introduces NaNs but does not raise an error. Matlab and Julia do raise errors.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>-- <o:p></o:p></p><p class=MsoNormal>Robert Kern<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>