So, let's start out by saying I am NOT asking which is better.I like both of these languages for data science and I think this is a matter of and rather than or since there is no need to choose one of them. My general opinion is that R has more data science depth while Python has more breadth in terms of diversity of application.I will start this out with a few of my own scattered opinions.PythonI tend to use Python as the overarching language (sometimes using it to execute scripts in R) since:Installed standard on Macs and many *nix setupsEasy to install/set up in environments with security restrictionsHas a great suite of tools whether I want to:Set up a websiteInteract with the Apache suite of toolsBuild out pipelinesBuild and score predictive modelsDevelop an application / front-endHas a larger audience if I get stuck and need to ask questions on hereDebug / Unit testAuto Document A good example of this was in building a Robot some facial recognition stuff over the summer. Raspbery Pi comes with Python by default, the sensors had Python API's, and a few of the web API's I bumped up against had Python API's available. This would have been a difficult application to take on using R.RI like to use R for early data explanation since data table tends to load larger sets into memory more quickly than Pandas and the general environment seems more mature for exploratory stuff. If I need mixed models or something similar that isn't Machine Learning bread and butter R is more likely to have what I need.  sklearn is pretty good but doesn't feel quite as polished as what I have in R.On the data viz side, ggplot2 is obviously better than matplotlib (the html based stuff is tough to share in an environment with heavy IP and security restrictions so I tend to lean towards the simple stuff.)How do you use them?How do you interact with these languages? Do you mix them together? Specialize in one? What's your rationale? Strengths/weaknesses?
Pros and Cons of Python and R for Data Science
python;r
Interaction - Random FactsBoth are good stable languages with interesting complementary qualities. You can get much better packages in one and then stitch them with some data from the other. An example is using time series forecasting and decision trees in R and doing data munging in Python.Both languages borrow from each other. Even seasoned package developers like Hadley Wickham (Rstudio) borrows from Beautiful Soup (python) to make rvest for web scraping. In addition to that, Yhat borrows from sqldf to make pandasql and many other. Rather than  reinvent the wheel in the other language developers can focus on innovation because, in the end, the customer does not care which language the code was written, the customer cares for insights.Mixing Them UpAM mentioning few approaches to mix them together-Use a Python package rpy2 to use R within Python . [Demo]Use Python from within R using the rPython package. [Demo]Use Jupyter with the IR Kernel. Python and R and makes the interactivity of iPython available to other languages.Use Beaker Notebook. It allows you to switch from one language in one code block to another language in another code block in a streamlined way to pass shared objects.Python vs RPython vs R - This section will answer:Which will be better?How to choose one over other?Specialization See as I said earlier both are stable and you can choose any or work with both. But when it comes to master one I'll suggest keep these 3-4 guidelines in mind-Personal PreferenceChoose the language to begin with based on your personal preference, on which comes more naturally to you, which is easier to grasp from the get-go. To give you a sense of what to expect, mathematicians and statisticians tend to prefer R, whereas computer scientists and software engineers tend to favor Python. Project selectionYou can also make the Python vs. R call based on a project you know youll be working on in your data studies. If youre working with data thats been gathered and cleaned for you, and your main focus is the analysis of that data, go with R. If you have to work with dirty or jumbled data, or to scrape data from websites, files, or other data sources, you should start learning, or advancing your studies in, Python.CollaborationOnce you have the basics of data analysis under your belt, another criterion for evaluating which language to further your skills in is what language your teammates are using. If youre all literally speaking the same language, itll make collaborationas well as learning from each othermuch easier.Job marketJobs calling for skill in Python compared to R have increased similarly over the last few years. Note: Have a look at this infographic by DataCamp. For a better view on it.My RationaleIn my case am doing both and using them interactively and Customizing them as per my use. You can get something really interesting in one (as I mentioned above) which will be hardly available in other, so it's better to use both together. This is the best way to bridge the gap between these two.But in the last, it's your call keep the guidelines, your interest, and scenarios in mind and make a clear view on that.Strength & WeaknessesRStrengthR is great for prototyping and for statistical analysis.It has a huge set of libraries available for different statistical type analysis. Check The Comprehensive R Archive.RStudio IDE is a definitely a big plus. It eases most of the tedious tasks and fastens your workflow.WeaknessesThe syntax could be obscure sometimes.It is harder to integrate to a production workflow.In my opinion, it is better suited for consultancy-type tasks.The libraries documentation isn't always user friendly.PythonStrengthPython is great for scripting and automating your different data mining pipelines. It is the de facto scripting language nowadays.It also integrates easily in a production workflow. Besides, it can be used across different parts of your software engineering team  (back-end, cloud architecture etc.).The scikit-learn library is awesome for machine-learning tasks.Ipython (and its notebook) is also a powerful tool for exploratory analysis and presentations.WeaknessesIt isn't as thorough for statistical analysis as R, but it has come a long way these recent yearsIn my opinion, the learning curve is steeper than R, since you can do much more with Python.The ConclusionUse R and Python. Learn how they inter-operate together. Start with one and then add the other to your workflow. As I like to remind myself- choosing the tools should never be the primary problem. When in doubt, use the one that is available and that gets the work done quickly. Hope it helps!Ref- Udacity, Quora, Letustweak, kD, DataCamp