Iterators and Iterables in my Python data science workflow

Most of my career in data science I have not made the optimal use of the Python programming language. To be honest I never formally learned Python, thus my initial projects were more of a hack than any structured thinking. In the last few days, I decided to relook at some of my older projects in Python and impose better programming ideas to those projects. One mistake I have kept noticing is the misuse of iterables in code. This blog is a discourse on these two fundamental Python concepts — Iterators and Iterables.
Sum of Factorial
As a running example let’s think of a program that adds the factorial of the first n integers together. This is a slightly contrived example, but this pattern is quite common in many data science applications I have seen. If you are anything like me, you will have written a program like the one below.

You will immediately notice a problem with this program. We are recomputing factorial(1) to factorial(n-1) to calculate factorial(n). So, the smart reader will rewrite a specialized function that is efficient.

Specialized functions, however, should be avoided as far as possible in a function style programming. A specialized fact_sum(n) function can’t be used in any other program that needs a factorial. As data scientist, most of the code that I write is of function style and I would like to avoid specializing a function. For a more systematic overview of functional programming check out this how to.
Iterables and Iterators
An alternate approach here is to develop an Iterable and use an Iterator to get the factorials. Most of us have used iterators in every program written in Python. The title of this post for i in range(n): is one such example. Range function returns an iterator. The code below shows an iterator pattern for our factorial problem. In this example we create an Iterable by implementing a iter & a next method.

#iteration #python3 #iterables #machine-learning #deep learning

What is GEEK

Buddha Community

 Iterators and Iterables in my Python data science workflow
akshay L

akshay L


Data Science With Python Training | Python Data Science Course | Intellipaat

In this Data Science With Python Training video, you will learn everything about data science and python from basic to advance level. This python data science course video will help you learn various python concepts, AI, and lots of projects, hands-on demo, and lastly top trending data science and python interview questions. This is a must-watch video for everyone who wishes o learn data science and python to make a career in it.

#data science with python #python data science course #python data science #data science with python

Uriah  Dietrich

Uriah Dietrich


How To Build A Data Science Career In 2021

For this week’s data science career interview, we got in touch with Dr Suman Sanyal, Associate Professor of Computer Science and Engineering at NIIT University. In this interview, Dr Sanyal shares his insights on how universities can contribute to this highly promising sector and what aspirants can do to build a successful data science career.

With industry-linkage, technology and research-driven seamless education, NIIT University has been recognised for addressing the growing demand for data science experts worldwide with its industry-ready courses. The university has recently introduced B.Tech in Data Science course, which aims to deploy data sets models to solve real-world problems. The programme provides industry-academic synergy for the students to establish careers in data science, artificial intelligence and machine learning.

“Students with skills that are aligned to new-age technology will be of huge value. The industry today wants young, ambitious students who have the know-how on how to get things done,” Sanyal said.

#careers # #data science aspirant #data science career #data science career intervie #data science education #data science education marke #data science jobs #niit university data science

Data Science with Python Certification Training in Chennai

Learn Best data science with python Course in Chennai by Industry Experts & Rated as and Best data science with python training in Chennai. Call Us Today!

#data science with python training #data science with python courses #data science with python #data science with python course

Manish Sharma


Applied Data Science with Python Certification Training Course -IgmGuru

IgmGuru’s Data Science with Python certification course has been designed after consulting some of the best in the industry and also the faculty who are teaching at some of the best universities. The reason we have done this is because we wanted to embed the topics and techniques which are practiced and are in demand in the industry – conduct them with the help of pedagogy which is followed across universities – kind of applied data science with python. In doing so, we make our learners more industry/job-ready. IgmGuru’s Data Science with Python online training course is the gateway towards your Data Science career.

#applied data science with python #data science with python certification #data science with python online training #data science with python training

 iOS App Dev

iOS App Dev


Your Data Architecture: Simple Best Practices for Your Data Strategy

If you accumulate data on which you base your decision-making as an organization, you should probably think about your data architecture and possible best practices.

If you accumulate data on which you base your decision-making as an organization, you most probably need to think about your data architecture and consider possible best practices. Gaining a competitive edge, remaining customer-centric to the greatest extent possible, and streamlining processes to get on-the-button outcomes can all be traced back to an organization’s capacity to build a future-ready data architecture.

In what follows, we offer a short overview of the overarching capabilities of data architecture. These include user-centricity, elasticity, robustness, and the capacity to ensure the seamless flow of data at all times. Added to these are automation enablement, plus security and data governance considerations. These points from our checklist for what we perceive to be an anticipatory analytics ecosystem.

#big data #data science #big data analytics #data analysis #data architecture #data transformation #data platform #data strategy #cloud data platform #data acquisition