Rajat Gupta
2+ of articles published
Logical Mind / Structure Developer / Syntax Strategist
Domain:
upGrad
Current role in the industry:
Sr. Data Scientist at SCI-BI (Big-Data, AI/ML, Analytics, IIOT, CRM)
Educational Qualification:
Master of Technology (MTech) in Nanotechnology from Sikkim Manipal Institute of Technology.
Expertise:
Machine Learning
Python (Programming Language)
Natural Language Processing (NLP)
Data Visualization
Automated Machine Learning (AutoML)
Deep Learning
Tools & Technologies:
Python
R
Machine Learning
Data Science
Big-Data
AI/ML
Analytics
Certifications:
Finance: Time Value of Money from Smartly Learning.
LinkedIn Skill Assessments in Machine Learning and Python (Programming Language).
Introduction to Machine Learning by Andrew Ng
About
Born and brought up in New Delhi and a lucrative background in the field of Nanotechnology, he shifted his course to data and now is the Lead Data Scientist at SCI-BI where his broad experience with various aspects of digital products has allowed him to successfully venture into product management. You can reach him at- https://www.linkedin.com/in/rajat-gupta-784a09164/
Published
Most Popular
7167
A Complete Python Cheat Sheet (Updated 2024)
The United States has the largest number of software developers specializing in technologies like Python. If you want to be one of them, it is best to start with the fundamentals. We have compiled a Python cheat sheet below to kickstart your learning journey! Applications of Python As a leading general-purpose programming language, Python is used for a wide range of industry applications. Here are some of its popular use cases: Web development is backed by frameworks like Django, Pyramid, Flask, and content management systems such as Plone. Scientific and numeric computing powered by SciPy, Pandas, IPython, etc. Desktop GUIs enabled by toolkits like Livy, wxWidgets, PySide, and GTK+. Software development, including build, control and management, and testing. Programming-related education and training, both at the introductory and advanced levels. Business applications encompassing ERP and e-commerce solutions. Examples of enterprise application platforms include Odoo and Tryton. In terms of technical skills, Python lets you master two coding tasks at once, i.e., server-side development and machine learning. It is open-sourced, equipped with extensive libraries, and supports user-friendly data structures. Moreover, you can easily find a Python cheat sheet pdf online to clarify the basics. The following Python cheat sheet will familiarize you with the data types, math operators, strings, functions, lists, and tuples. We have also included Regular Expressions (Regex) information to give you a well-rounded view of the programming language. Getting Started with Python The first step is to check whether your computer has pre-installed Python. You can do so via the Command Line search. After that, you can begin writing your code in any text editor and save the file in .py format. You would then be able to run the code in the Command Line prompt. However, this approach is suitable only for straightforward, non-data science tasks. You might want to switch to IDE or IDLE if you want to interpret your code. If you are a beginner in python and data science, upGrad’s data science online courses can definitely help you dive deeper into the world of data and analytics. IDLE stands for Integrated Development and Learning Environment. Every installation comes with a Python IDLE that highlights relevant keywords or string functions. Shell is the default mode of operation that lets you test various code snippets via the following tasks: Read statements Evaluate results Print results on the screen Loop to the next statement Data Types in Python A Python value is termed an “object.” Every object has a particular data type. Here is a list of the most-used data types with examples: Integers: Represented by keyword (int), it includes integer numbers, such as -2, -1, 0, 1, 2, etc. Floating-point numbers: Non-integer fractional numbers denoted by (float). For example, -1.5, -1, -0.5, 0, 0.5, 1, 1.5 Strings: Sequence of characters that cannot be changed once defined. For example, “hello”, “hey”. Typically, single, double, or triple quotes are used to create a basic Python string. Whichever option you choose, keep it consistent throughout the program. Here are some other things to keep in mind: The print() function would output your string to the console window. You can apply join() or replace() to modify these strings but cannot rewrite the original. Lists: Ordered sequence of elements that keep the data together so that you can perform operations on several values at once. Each value is termed as an “item” and placed within square brackets. The items can be changed once stored. Consider the examples below. one_list = [1, 2, 3, 4] two_list = [“b”, “c”, “f” “g”] three_list = [“4”, d, “car”, 7] Tuples: Similar to lists, but the stored values cannot be changed. You can create a tuple as follows: new_tuple = (5, 6, 7, 8) my_tuple[0:5] (2, 3, 4) Dictionaries: Indexes that hold key-value pairs. It can include integers, boolean, or strings. For instance, Buyer 1= {‘username’: ‘john doe, ‘online’: true ‘friends’:150} You can use the any of these two options to create a dictionary: my_dict = {} new_dict= dict() Let us now look at the common practicalities of these data types. String Concatenation & Replication Concatenation involves adding two strings together with the “+” operator, as demonstrated below. my_string = “I love” other_string = “reading books” final_string = my_string + other_string Notably, concatenation is only possible for the same data types. If you try to use “+” for a string and integer, you will encounter an error in Python. The replication command lets you repeat a string using the * operator. ‘Alex’ * 4 ‘AlexAlexAlexAlex’ print(“Alex” * 4) However, this only holds true for string data types. When * is applied to numbers, it acts as a multiplier, not a replicator. Math Operators You can apply several math operations with numbers via specific operators. For reference, let’s examine this list: To return an exponent, use “**” (2 ** 4 = 16) To multiply numbers, use the single asterisk sign, “*” (2 * 2 = 4) To get the quotient in integer division, use “//” as the operator (20 // 8 = 2) For the remainder, apply the “%” symbol (20 % 8 = 4) For the floating point number, apply “/” (20 / 8 = 2.5) For subtraction, “-” is the standard operator (6 -2 = 4) To add numbers, use “+” (3 + 3 = 6) Functions in Python Functions are blocks of coded instruction capable of performing particular actions. Python has some built-in functions, namely: Input(): Prompts the user for input, which is further stored as a string. len(): Finds the length of strings, lists, tuples, dictionaries, and other data types. filter(): Excludes items in iterable objects, such as lists, tuples, or dictionaries. You can also define your own function using the def keyword followed by name():. Here, the parentheses can either stay empty or contain any parameters to specify the purpose of the function. Performing Operations with Lists The list() function provides an alternate way of creating lists in Python. The statements mentioned below illustrate this option. my_list = list ((“1”, “2”, “3”)) print(my_list) The append() or insert() functions are used to add new items to a list. Functions like remove() and pop() let you remove items from a list. Alternatively, you may try the del keyword to delete a specific item. The “+” operator combines two lists, and the sort () function organizes the items in your list. Working with ‘If Statements’ Python supports the basic logical conditions from math: Equals: a == b Not Equals: a != b Less than: a < b Less than or equal to a <= b Greater than: a > b Greater than or equal to a >= b You can leverage these conditions in various ways. But most likely, you’ll use them in “if statements” and loop. The goal of a conditional statement is to check if it’s True or False. if 5 > 1: print(“That’s True!”) Output: That’s True! You can know more about Nested If Statements, Elif statements, If Else Statements, and If-Not statements in any Python cheat sheet pdf. Creating Python Classes Every element, along with its methods and properties, is an object in Python, considering it is an object-oriented programming language. Classes are blueprints for creating these objects. While a class is manifested in a program, objects are the instances of the class. Suppose you have to create a SampleClass with a property named x. You will begin with: class SampleClass: z = 4 In the next step, you will create an object using your SampleClass. You can do so using p1 = SampleClass(). You can further assign attributes and methods to your object with a few simple steps. Python Exceptions (Errors) Here is a list of some common errors that pop up while using Python. KeyError: When a dictionary key doesn’t feature in the set of existing keys. TypeError: When an operation or function is inapplicable to an object type. ValueError: When a built-in operation or function gets an argument with the correct type but of inappropriate value. IndexError: When a subscript cannot be detected, being out of range. ZeroDivision: When the second argument of a division operation is zero. AttributeError: When an attribute assignment fails. ImportError: When an import statement fizzles in locating the module definition. OSError: A system-related error. For troubleshooting these errors in Python, you can use exception-handling resources — try/except statements. Python Regex Cheat Sheet Regex is an integral part of any programming language. It helps you search and replace specific text patterns. In other words, it is a set of characters that lets you remember syntax and how to form patterns depending on your requirements. So, let’s look at some useful regex resources for Python. Basic characters ^ matches a string expression to its right before the line break $ matches the expression to its left before the string experiences a line break xy matches the xy string. a|b matches the a or b expressions. b is left untried if a gets matched first. Quantifiers + matches an expression to its left once or more than once. * matches an expression to its left 0 or multiple times. ? matches an expression to its left between 0 and 1 time. {p} matches an expression to its left not less than p times. {p,q} matches an expression to its left between p and q times. {p,} matches an expression to its left p times or more than p times. {,q} matches an expression to its left through q times. Module Functions re.findall (A, B) returns a list of all instances of expression A in the B string. re.search (A, B) returns a re-match object of the first insurance of expression A in the B string. re.sub (A, B, C) replaces A with B in the C string. You can find more regular expressions on character classes, sets, and groups in any Python regex cheat sheet available online. Summing up In this blog, we detailed the foundational steps of working with the Python programming language. We covered everything from IDLE to integers, strings, lists, dictionaries, tuples, and math operators. We also learned how to define a function and discussed examples of different statements and errors. By no means is the above checklist complete, but it can definitely help you get the hang of Python. Once you are through with these nuts and bolts, you can increase your speed and productivity with regular practice. Additionally, Python’s active support community and advanced online courses can help you stay updated. Check out upGrad’s Executive PG Program in Software Development and other programs in technology, data science, and machine learning. The platform allows the flexibility to learn at your own pace, a benefit that is celebrated in over 85 countries. upGrad courses have transformed the career trajectory of more than 40,000 paid learners and 500,000 working professionals globally. Perhaps the above Python cheat sheet would fuel your curiosity to explore and upskill!
by Rajat Gupta
09 Aug 2021
5352
Increasing Blocks of Individual Investors and Digital India: Can India become the next financial superpower?
The old adage tells us that there are two sides to every coin, but what if it is just a bad penny? Case in point, the pandemic. It is all any of us have talked or thought about, and the sentiment is mostly negative. However, as the epidemic unfolded, we began realizing that some surprising positives may result in keeping economies afloat worldwide. In this article, we will analyze the unprecedented rise in the sheer number of retail investors in the securities market. What sets them apart? Unlike institutional investors, usually banks, insurance companies, retirement funds, or hedge funds, retail investors are individuals like us who invest in their own volition, mostly through a broker. It has been observed that the number of retail investors, especially in the months – April, May, and June of 2020 have doubled, and Central Depository Services Limited (CDSL) shows that 19.6 lakh new accounts were added in these three months, which averages to 6.5 lakhs/month as opposed to 3 lakhs/month for the same period in FY 2019-20. Data Source: SEBI As we can see here, the trend is strong, and the growth has been nothing less than exponential since 2015, which begs the question of what happened in 2015? The answer might be found in the Digital India Initiative, which made tier 2 and tier 3 cities and even suburban areas empowered with greater internet reach. Which means, everyone with a phone could take their financial future literally in their own hands. Source According to the latest report, the Securities and Exchange Board of India (SEBI) is considering giving full direct market access to retail investors in India, which means that they’ll not need brokers to be able to invest in both BSE and NSE. Data Source: Edelweiss Securities This act marks the change in the way the Indian workforce is entering the game at breakneck speed with a massive jump in the number of retail investors, from 45% in FY 2019-20 to 68% in June. There are reports that it has even breached the 70% mark in July! Why the rise and why now? It could be attributed to individuals with a steady income, looking for easy ways to save with high long-term returns, now that there is a less unnecessary expenditure, and there is more time in hand to self actualize the will to learn how financial markets work. A rise in salaries demands investment for a tax break. Otherwise, high salaried people end up paying high tax (30% above 10 lakhs), but this can be brought down significantly if you are investing in certain tax-saving schemes. It could also mean that job security has become endangered during the pandemic. People have become more aware of the importance of saving money for a rainy day. Although that might be a very broad way of looking at it, the pandemic has certainly allowed people to take a more focused approach with their equity investments, mutual funds, and commodities. With gold closing at the highest price in over a decade at 55,675 INR for 10g of 24 carat as of 31st July 2020, there is a surge for selling and investing in gold, which currently is a more stable investment given the volatility of times. Learn Digital Marketing Course online from the World’s top Universities. Earn Masters, Executive PGP, or Advanced Certificate Programs to fast-track your career. But the way people are buying gold has also changed. Fundamentally when we think of investing in gold, we think physical gold. But many factors affect that decision like purity, safety, and so on, especially when the situation right now encourages one to invest in digital gold or ETF, which are exchange-traded funds traded on stock exchanges. They hold assets such as stocks, commodities, or bonds and are generally designed to keep their trading as close to their net asset value as possible. Other reasons might be the significant rise in average national income or it might even be stress-related as everyone is looking at the future more precariously. How is it happening now? In addition to looking away from the traditional approach to investments (such as Banks FD and LIC) which arguably gives low returns, there is a rise in the number of discount brokers that are making it easier for even a layman to understand the intricacies of markets and encourage them to invest with ease. Discount brokers are those who allow individuals to invest in securities at minimum or zero brokerage. Others reasons for more people opting for MF or Gold than LIC could be: No lock-in period – withdraw anytime, more flexibility and control over funds. Numerous options, depending upon understanding of sectors, risk appetite, and pocket Like LIC, MFs are also regulated by the government, so the risk of fraud is minimum. An option to switch from one fund to another giving more flexibility which is not possible with LIC. While compounding money grows with time, LIC ends after a fixed period and you cannot continue. However, MF can be held onto for as long as one wants thus, exponentially increasing the returns in the longer run. Better digital transaction facility which means more modern infrastructure and web design. Applications like Binomo, Zerodha, 5paisa, and Upstox are quite popular with investors that fall under the younger age bracket with enthusiasm for making a quick buck through trading or dreams of getting higher returns on long term savings. Their priorities lie in preserving their future and living their best life in the present as well. Zerodha says that they’ve seen almost a 300% jump in new accounts joining in every month. Motilal Oswal team has also commented that their digital platform has handled more than a million trades per day since the lockdown. Data Source : Business Insider Apps are also a means to invest in foreign equity for institutional investors. Actually, some mutual funds invest exclusively in American companies. Although retail investors cannot directly invest in foreign markets as of today, apps like Zerodha and Upstox are trying to make that happen as they’re in talks with SEBI and other regulatory bodies. An increase in the popularity of peer-to-peer lending and digital gold, shows that investors are empowered to make decisions to trade online confidently. Cryptocurrency, although shrouded in doubt since its inception, looks like an attractive way to securely store money as it maintains a distributed public ledger with the help of blockchain technology where all the transactions are accounted for. Read: A Blue-print of the Pandemic Hit Auto Industry in India What could be the impact? The more money flows, the better it is for the economy since stagnant money doesn’t grow. India’s large population is its working class youth. The overall impact on the economy can be humongous and possibly positive. But throwing caution to the wind isn’t advisable as Aditya Narain, Head of Research at Edelweiss Financial Services, while talking to The Economic Times says, “Historically it has always happened like this after every major crisis.” Source: Weforum.org Taking the Global Depression in the account, there was a reasonably sharp bounceback. Nifty made a 40% jump from a low in March is a cause for celebration as well as keeping our eyes open for trouble. With an increase in the number of investment instruments, digital platforms, and resources to gain financial literacy, it is certainly a great time for retail investors. It’ll be interesting to see if this upward trend continues in the coming years and how it contributes to the overall economic growth and helps India transition into a financial superpower. If you are curious to get into the world of digital marketing, check out upGrad & MICA’s Advanced Certificate in Digital Marketing & Communication.
by Rajat Gupta
12 Aug 2020