Applied Data Science With Python Full Course 2026 [Free] | Python For Data Science | Simplilearn
Chapters14
Overview of how data science uses Python and introduces the three core tools NumPy, Pandas, and Matplotlib that will be covered.
A pragmatic, example-driven guide to numpy and pandas in data science, showing how Python handles data, from arrays to 2D tables and basic analytics.
Summary
Simplilearn’s Applied Data Science with Python course walks you through core Python tools for data handling, emphasizing NumPy for numerical arrays, pandas for tabular data, and matplotlib for visuals. The instructor emphasizes that Python plus NumPy, pandas, and matplotlib power real-world tasks like cleaning messy data, turning text into numbers, and creating insightful charts. You’ll see concrete demos of creating ND arrays, reshaping them, flattening multi-dimensional data, and performing element-wise arithmetic and statistics with NumPy. The session then transitions to pandas, introducing Series and DataFrame structures, indexing, and common operations like head/tail, describe, and value_counts, with practical examples using wardrobe data and a sample Titanic-like dataset. Throughout, the讲解 stresses the end-to-end data science flow: problem definition, data collection (CSV or other sources), exploration, feature engineering, and visualization, with a wary eye on best practices like local versus cloud environments (Anaconda, Colab) and why pandas is preferred for tabular data. The talk also covers how to read CSVs, the difference between Series and DataFrame, and how to handle missing data with NaN and fill strategies. Finally, the instructor teases how to apply these tools to real datasets (e.g., Titanic) and hints at transitioning into the machine learning portion in later courses. This is an actionable primer for beginners who want to go from raw data to analysis and visuals using Python’s data stack.
Key Takeaways
- NumPy provides ND arrays with contiguous memory, enabling fast, element-wise operations that are much quicker than pure Python lists.
- Reshape in NumPy lets you change a 1D array into 2D or 3D forms as long as the total number of elements remains constant (e.g., 10 elements reshaped to 2x5).
- Flatten converts any dimensional array to 1D, which simplifies operations that are easier in one dimension and can then be reshaped back.
- Pandas introduces Series (one-dimensional with an index) and DataFrame (two-dimensional tabular data with labeled axes) to handle real-world data more naturally than raw NumPy arrays.
- Series .head() and .tail() quickly preview data; .describe() summarizes key statistics; and .value_counts() reveals data distribution for categorical-like data.
- Missing data in Pandas is represented as NaN; you can detect it with isnull/isna and fill it with fillna to maintain dataset integrity.
- Reading external data (CSV, Excel, JSON, etc.) is straightforward in pandas via read_csv, read_excel, and similar readers, enabling seamless integration of real-world datasets like Titanic.
Who Is This For?
Essential viewing for beginners in data science who want to move from Python basics to practical data work with NumPy and pandas, including those preparing for the machine learning portion of the course. It’s also a handy refresher for developers shifting from scripting to data-centric analysis and visualization.
Notable Quotes
"Python is the tool that makes it all happen."
—Introductory claim about Python's role in data science.
"NumPy, pandas, and matplotlib. Don’t worry if these sounds new to you. We’ll break them down step by step."
—Outline of the three core tools covered in the course.
" reshape changes the dimension of an array from any shape to any shape."
—Explanation of the reshape operation in NumPy.
"Series and DataFrame are two major data structures in pandas—the building blocks for working with tabular data."
—Introduction to pandas data structures.
"Missing data in Pandas is represented as NaN; you can detect it with isnull and fill it with fillna to maintain dataset integrity."
—Handling missing data in pandas.
Questions This Video Answers
- How do NumPy arrays differ from Python lists in data processing performance?
- What is the difference between a Pandas Series and a DataFrame?
- How can I read a Titanic CSV file into a Pandas DataFrame and inspect basic statistics?
- How do I handle missing values in Pandas using isnull and fillna?
- What are the best practices for running Python data science work locally (Anaconda) vs in Colab?
PythonNumPyND arrayreshapeflattentransposearithmetic and statistical functionspandasSeriesDataFrame (tabular data structure)
Full Transcript
Have you ever wondered how companies predict what products you will like or how search engines gives you exactly what you're looking for? That's all data science at work. And guess what? Python is the tool that makes it all happen. In this course, we are going to explore how Python helps us handle data, make sense of it, and even turn it into something useful. We'll focus on three key tools. Numpy, pandas, and mattplot lip. Don't worry if these sounds new to you. We'll break them down step by step. Here's what we will cover in today's video.
First, we'll dive into NumPy where you'll learn how to create and manipulate arrays. You'll also cover how to do all sorts of calculations like finding averages, medians, and more. Basically, making your data do whatever you want it to do. Next, you'll also get handson with pandas. You'll discover how to clean up messy data, handle missing values, and transform data so it's ready for analysis. You'll also talk about turning text into numbers, which is super important when you're working with data. Then we'll talk about Mattplot Lib. This is where the fun happens. You'll learn how to turn all the data into cool visualizations like charts and graphs.
You'll see how visualizing data can help make better decisions. Along the way, you'll also talk about the real world data science process, how to figure out what problem you're solving, how to explore and understand your data, and how to use the right tools to get results. By the end of this course, you'll be comfortable using Python to handle data, clean it, analyze it, and even show it off with visuals. Whether you're just starting or looking to sharpen your skills, we have got you all covered. So, let's get started to unlock the power of data with Python.
Before we commence, if you're interested in mastering the future of technology, the professional certificate course in generative AI and machine learning is the perfect opportunity for you. Offered in collaboration with E and ICT Academy, IIT Kpur, this 11month live and interactive program provides hands-on expertise in cuttingedge areas like generative AI, machine learning and tools such as chat, GPT, DALE and also hugging face. You'll gain practical experience through 15 plus projects, integrated labs, and live master classes delivered by esteemed IIT Kpur faculty. Alongside earning a prestigious certificate from IIT Kpur, you'll receive a official Microsoft badges for Azure AI courses and career support through SimplyLearn's job assist program.
Hurry up and enroll now. Find the course in the description box below and in the pin comments. Here's a simple quiz question for you. What does pandas help you do in data science? Is it to visualize data, clean and organize data, create machine learning models or is it to build websites? Let us know your answers in the comment section below. Next, we'll talk about the concepts about the data science part. What is data science? What is the process and so on. Again, that's the first page right that I have as a part of think. So a fundamental definition that we goes through with it is use of scientific methods, processes and algorithms to derive meaningful insights from the data.
That is the idea behind it. I will not go through with that right. I will not talk about this. What I'll try to talk about is to think of a real world scenario. I am giving you guys a scenario. Can you on everybody I hope so everybody can see my screen. on my screen. Can you see there is a bulb? Yes or no? Great. Thank you, Gilbert. Thank you, Priti. Now, that's data for me. I'm giving you this data. This is a data. It's a visual data, right? It's a visual data. Now, think yourself as a person who is a data scientist, right?
who is a data scientist at some bulb manufacturing company, right? Some bulb manufacturing organization, right? You're a data center as a bulb manufacturing organization. You're walking out of your house and you saw this bulb. You're walking out of your house going to work. Imagine you're going to work and this bulb was there into the next house or maybe somewhere on the road you found out this particular or somewhere on the pathway you found out this particular bulb there. Great hypothetical situation but thinking process this is the most important part for a data scientist for an AI engineer is the most important part is the thinking process.
How do we think about it? Now think about what you can recommend as data scientists considering this particular bulb as an input right this is the input to you think about that okay you may not know what is data scientist roles but whatever your understanding of data scientist based upon that right or AI engineer course right whatever your course enrolled into what is your approach approach towards a business proposition uh about this particular information that you have that you can recommend to your let's say the uh to the management she over there maybe you can tell okay I saw that bulb on the street and I have so many so so and so recommendations for you anything that you would like to talk about or let's talk about what you can tell me about this bulb let's say how will you draw insightful information about the data.
Can you tell me about this bulb? Just information. No decision making. Just about the bulb. Tell me what information you can give me. I'm okay with that. You say that the bulb is yellow. That is also an information. It's a screw base bulb, not a click and lock method. Uh, it's brightness level. Okay. 12 bulb dimensions. Great. What else? See, I'm looking for spot towards something. Power consumptions, great. Materials used, wattage, great. Lights when connected power okay that should be you know a basic property pretty yeah but it's still still good anything else see I want you guys to observe thing take your time observe because whenever you are saying let me just try to tell you I have too many options came up like abinitri says brightness level is it observable from the given image the bible dimension gilbert But is it observable?
Is it available on the given data? The power consumption. Narendra says that wattage or the material used lights when connected power. How many watts is that available with the given data? Can you actually imp you know find it out from the given information? Uh Ajay Shri what is that? Yeah. Yeah. Uh Sam is coming up to caution validation required before green on top some black dot is there. Yep. What does that implement? E27 bulb holder agreed. Dashish it is an object. It is an object. Okay. Any object. So I tend to you know closely follow the observation from Sam.
The kind of inference that you might require to take it up is something which is unusual. Right? something which is unusual because as a data scientist or as an AI engineer uh everybody knows right you know I know you can see the options coming from 10 different people's in the chat window as well someone is talking about you know wattage powers luminosity and so on so forth right but something different something that makes you unique something that is nobody else is able to observe And that has some meaning. So Sam talked about there is a black dot on the top.
What what do you recommend? What is the you know reason behind it or what would be the implication? Uh it's a filament bulb. Great. It's a filament used in the bulb. It's a tungsten bulb. Great. So one observation which is you know directly not available but it is hidden none of the bird manufacturer label that's not available right the bird but what I can observe let me just put it across what I want to convey to you guys is right with this particular image see here I can see that there is a black dot on the top right it's a black dot on the top that black dot tells me that whatever the outer covering is right of this bulb that outer covering is getting blackened out.
That means the intensity of the power inside the bulb is such high that it is turning out the features outside or the outer body is black. And if that is happening that means it has to be usually a tungsten bulb. That's number one. It's a tungsten bulb. Second thing, this does not happen over a day. This does not happen over a day. It happens over a period long period of time. It also tells me it's a very old bulb, isn't it? Do we agree? Thank you. And if it is a very old bulb as business perspective, I can think of Yeah.
incandescent bulbs for example. Yeah. Similarly, it's a very old bulb. Now I can think of an alternative bulb. I can think of as a business proposition. I can think of an alternative bulb that does not give the black structure gives me better you know life or maybe something like that. It's not using tungsten technology maybe using some other technology like light emmitting diodes could have been any other solutions right which will offer a better or cheaper options. Make sense? Now why did I discuss about this bulbs for so long? The only reason I wanted to talk about is not the bulb but the approach.
Make sense? See I can go on with this theoretical presentation for a long period. Not a problem. But the point is this is not what we here to learn. You can go through with this presentation 10 number of times. You will have access to this presentation. So I will not concentrate more on to the presentation part but what we need to do in real world I'll try to concentrate more on that is that okay with everyone right presentation is something that you guys can read through 10 number of times and most of the slides are self-explanatory on this so what did you learn from here that Whenever you're getting a data, whenever you're going to work around with a data, you do not look for things which are obvious, right?
You need to look for things which are not obvious, isn't it? Now, in order to find out those things, you require certain kind of methodology. Here it was easy for us, right? Because we can see that pictorially. There's a picture available and I can see that part. I can see that shine. there is a you know slight little curvature onto the active I can use that too for some informative purpose like it's in a background where there is too much light that's why I have that shiny part or shiny curve on the top that means there's a background light reflecting on that particular bulb right so understand this part that it is not about that what is given already in the data It's not important because everybody can see that.
What is important is what is hidden in the data. Is that okay? Thank you. Hopefully. Thank you. Okay. So moving on now I have some you know basic things to talk about very quickly walk you through with that. So the process of data science it's a kind of you know process where I would require a lot of information right I need to know about the domain I need to know about the scientific methods and technologies very important things right now domain is something that you may or may not be aware about at any point of time for example let's say if I talk about when I started my career as a data scientist I was coming from a financial background I was working in state bank of India prior to So I came up from a BFSI background banking and financial institutions.
So my core expertise was on finance but if you talk about over the period of time what kind of projects that I've dealt with I have dealt with the financial non-financial pharmaceutical I've aviation different kinds of projects that I've dealt with. So subject expertise is not something that you will have in all sections ever. This is something that you will acquire project twice. Right? You would have to do the hard work to read about the project, read about the domain, understand the domain, acquire knowledge about the domain. That is what you need to do, right?
When it comes to the scientific methodologies, right, that you need to do the scientific methodologies are the mathematical tools and the scientific tools that we have, right? So, I'll talk about that during this course. What are the scientific methodologies that you need to require to be a data scientist or any engineer? We'll talk about those mathematical and scientific concepts that are you know used in the real world. We'll talk about that during this course. As a part of technology, we require a machine and a programming language. Two things, right? A machine and a programming language to implement these things.
Good. So I have a programming language like Python. I can use that. There are other languages as well which allow you to do that. Then operating systems, data processing tools. Again we'll talk about the Python language slightly. Data processing tools, the libraries, the application design. We'll talk about all those things during this particular course. So that's your upcoming portion. Are we good? Keep on asking questions. Some of the applications of you know data science processes is being given up here. One of the data science process application is the biometric sensing of the data right you wear up a you know wristwatch or or the you know what do you call it as a smartwatch it counts up your steps it counts up your heartbeats and talks about the real-time information about that I can use that information and take out some decision- making process and make some conclusive decision let's say suppose my my wrist or my this particular smartwatch detects that my blood pressure is going beyond 200 right my blood pressure is going beyond 200 there is no movement in my body can be detected now might be possibility that I'm suffering from a cardiac arrest or I'm suffering from you know hyper blood pressure so I might require immediate you know emergency services help uh my Android device or my um you know whatever Apple device or whatsoever it may be right My smart device can make up an emergency call to the emergency services and send my location.
If it can send my location, emergency service can arrive at me and take necessary care, right? Without any human intervention, we can still deal with these things, right? So useful interactions that can happen. Another example of data science is the search recommendations. So recommendation systems we y not in this course but in the next course machine learning we'll talk about that. How does the recommendation system feature works? We'll talk about that. But yeah, recommendations that you might have observed on Google platform. You write down typing something and it starts you know showing up. Okay, this is what people have searched for or this is what is the possible next word.
So next word recommendation right suppose I want to write down um maybe you might have seen in how many have seen that okay while you're writing a mail right it tells you if write on hello it automatically shows you sir or madam and so on it asks you to press tap to select that option automatic recommendations of certain words completing a line completing a paragraph seen that for expecting. Yes. Yeah. Thank you. So that is coming not from just you know any kind of software. It's just a data science process the recommendation systems. Similarly your loan applications right?
Credit card applications or loan applications. They say that you'll get an approval in 2 minutes. Who's going to look after that application in 2 minutes? No one. It's a backend machine. Looks at your credit report. Looks at your history. looks at you know your application status and everything and makes up an informed decision based upon that data right you'll study about how does the decision-m process happens in ML course machine learning course right you'll study about that but as of now you can understand that this is an uh you know an application of data science there can be a lot of applications right uh any field that you think of there is an application any particular field you want to put up an example any specific field you think that I should put up the example with I can put that example no problems but ask it any specific field for example let's say you apply on on a job portal for a job you think that my job that my qualifications are exactly what is been required for a particular job you still do not get a Thank you very much Abinitri.
See this was you know theoretical portion. So I was not expecting too many questions with this part so far but I just want to follow the process. So this is the entire process that we have right in the field of data science right now in this there is few things right. The first thing is problem definition. Problem definition is a kind of a problem statement that is given to us right a client will come to your organization or to you to tell you that okay this is the particular problem that I'm facing particular business right say for example I'm a soap manufacturer I manufacture 10 different kinds of soaps out of those only one particular soap is not getting a high sales or the sales values are very low for that why is that happening now You need to answer as a data scientist or an AI engineer what what is the problem what is the possible cause of the problem and how we can rectify that problem right so once we know the problem based upon that problem we ask the client to provide the data right the data acquisition happens now what is the skill set that is required for data collection anybody I'm I'll only talk about the skill set as part of data collection.
Usually what happens is a client will tell you okay these are my you know database servers I have kept my entire transactions data or whatever the things that we have I've kept in particular database these are the login credentials that you will have take out these login credentials and fetch the data from there sensible so we should be aware about how to fetch data from different database servers now as a data science if you talk about end to end process uh people will seek those kind of things. If you talk about small or marginal organizations, very small organizations, they think of person who can do end to-end job.
But in bigger organization or mid-level organizations, they have a separate team who does the ETL portion. We call that as extract data and transform and load it back and then we have a different set of data scientists. But in general, the skill set that is commonly expected is structured query language. SQL not a part of this course. We'll not talk about SQL at all. That's a separate course altogether. You may have that as an optional topic but you should know about structured query language if not in detail but slightly about it. Are we good? So that is where we collect the data.
Either we'll do that through databases or we'll you know roll out Google forms. You see that there was a Google form rolled out to you at the beginning of the session. Isn't it? What was the purpose behind it? Yeah. There is one purpose that I get to know about you guys. But there is another purpose that there's a data collection process that is happening in the background of simply lab. They get to know you know uh those whatever the data scientist team that is working in the background for simply they will get to know okay what kind of learners are joining in what they know about what are the which industries and so on and so forth.
Lot of conclusions can be made out of this lot of business decisions can be taken out of that. Are we good? The data collection is not just with the SQL. It can be directly from the you know from the end users. It can be directly through you know online resources. You can extract it from web pages. You can just you know you know walk through with the web pages uh and you can use that maybe there is another library that you can use for data collection is BS4 beautiful soup that is a web scrapping library but that's not our objective.
We're not going to talk about these two portions, the problem definition and data collection. Why? Because we are going to go with the standard problem statement. There is a standard problem statement that will be given to you and there is a standard data right which is in the format of CSV. It is in the comma separated value format. So what I'm expecting is you will have a data set, you will have a problem statement and then we'll start working. Are we good? You will uh get this the problem statement maybe I'll address it live in the session.
The data set if it is available into your you know standard you know practice data sets it is available into your LMS otherwise if I will use some additional data sets I will share it with you guys. Okay, if I would require any one of those. So our learning for this particular course will be limited to this part only the part two and part three. We'll get to know how do we clean the data, how do we explore the data and how do we perform the feature engineering part. So this is the basic thing that we'll do here.
Right? In between there is a lot of things. How do we clean and explore the data? Exploration is the major part right because we need to make a lot of decisions about the data while doing the exploration. some part of model building is also you know part of this particular thing right we'll discuss into that part but we'll not actually build the model maybe if time permits I'll try to see some one or two models to be built up right but this part is not part of your curriculum model evaluation and model deployment we will not discuss that at all this is a part of your machine learning section right next course machine learning these three topics five six seven so essentially the entire nine sessions are dedicated to this particular ular portion only.
Now how important is that is you can understand this suppose if there is a project let's say there is a project of data science that talks about a particular problem and the time span given is 6 months to complete that project for example out of those six months you can imagine at least four month will only be spent on this part at least four month it can go up to five as This is very very critical factor because how good we clean the data and how good we manipulate the data that makes the next stage which is the model building more robust more efficient.
So that is one of the very critical factor in the field of data science or machine learning or artificial intelligence. How is the data being prepared? So data preparation is a really important topic and that is what we're going to learn through this course. Are we good? Okay. Python for data science uh preferred programming language across the industries have some advantages and disadvantages. We'll not talk about that. What are the important packages? Numpai is one of the important package. We'll discuss that in detail. Pandas is the second topic. Cypi we'll discuss that shortly for some period then stack model will come into the picture as well we'll talk about scikit learn uh not too much in detail but slightly about scikitlearn as well wherein I'll talk about what is scikit learn and some features of scikitlearn will come into the feature engineering course mattplot will discuss in detail se will discuss in detail plotly will come with the you know questions okay with the plot loops this is a types of plots with examples which is given into the presentation.
Uh wherein what is a line plot? Connect two dots and make join them with a straight line that becomes a light line plot. A marker plot highlight those dots and that becomes a marker plot. So you can see your dot dot dot dot. So that becomes a marker. Then there's a scatter plot uh which is typically you know used for the purpose of analyzing relationship between two data points. Right? We'll discuss all these plots in detail. This is just for your reference to know about these words. That's it. Then you have this area plot. You know that is also called as a stack plot.
Area plot and stack plot are same thing. And it talks about you know cumulative changes between certain datas. Right? We like see why I'm trying to rush through with this is because I need to talk about this how these are created and what kind of meaning they take up at a later stage as well. So I do not want to put up time here just to talk you know if I give you the details right now and then later on again same problem arises. So I need to talk about how they are created and how we will use them.
We'll do that all these graphs that I'm talking about. Bar plots again talks about the frequencies of the things how many things are appearing up how many times grid plots drawing of that grids histogram another plot very important plot that talks about the frequency distribution pie chart again talks about the frequency distribution that's it what is data exploration will we be diving into the specifics in a subsequent session yes definitely in the data exploration part we will talk about a lot of pretty there will be a lot of things as a part of data exploration essentially when I'll try to start working with the pandas library right when I start working with the data pandas library I'll tell you how to reach out to particular why to reach out to a particular data what inferences you are going to make out from a particular data and how will you deal with them every kind of possible scenarios the different sort of data sets I will try to include that whatever the possible situations that you may come up across in a real world scenario up to a certain limit right because I have limited number of data sets that I can talk about but yes I will talk about data exploration essentially that will be the most longest thing that we will have highest longest thing after the mathematics portion the maximum time we'll go on to mathematics but next thing that will be data exploration otherwise I just need to talk about syntaxes right suppose what is numpy what is numpy syntax is what is an array so basic concepts right so that will be a syntactical thing where I'll talk about syntax and tell you okay this is how the things are designed in python we need to follow the very strict pythonic way that is one thing I'll tell you this is this is what is supposed to be done that is fixed but when and why is something I'll let you know good all right so what I will do here is I am currently using Anaconda you know tool which you can do it by this way you can go on to anaconda.org download.success success.
I have shown that link and you can download your requisite install installation. If you're using a Mac machine just in case if you're using a Mac machine, you can go on to the Mac link and find out the downloader here either for silicon uh Intel chip is not available there. I am not sure but uh Apple silicon graphical Apple silicon command line is Intel chip is also should be available right so if there is any concern with that let me know otherwise you can get it from this this is a local installation that means that allows you to create files locally on your machine use your local hardware and work on the local manner but typically you can also use you know you a a cloud cloud based hardware and that is what you can use with the collab.
So you can search for golab.resarch.google.com once you go onto that page that should appear up with something like this if you're already signed into your Google account. If not it will not appear up that way but you can click on the new notebook option and you will come across with this kind of scenario. My uh office laptop is VS code install extension of Jupiter. I am okay with that sites. I'm okay with if you do not have to install that extension and you're putting up a path for Python up quoting uh yes simple does offer a lab you can use that but what will happen is in a later on courses like when you will you start machine learning or deep learning some later courses simply in lab is going to be not available and I do not recommend people doing the simply learn lab.
See, I am working for Simply Learn, but I do not recommend it. Why? Because there is a reason behind it. The reason is because some of the libraries in uh in that particular field are not current. They are slightly older one. They're not updated. And hence what happens is certain functionalities will not work in a proper way or they will work but they will not offer you this solution that you should expect out of it. Right. So I do not generally recommend people using simple. That's the the final you know ultimate thing that I tell people.
Okay. If you cannot do anything go with the labs. Great. I will recommend you to use collab. Anybody who's not okay with your local installation come to the collab page. That's how you will see it. I will just close out this you know AI companion and I'll put on one simple code print my name very simple thing I write down that piece of code into my cell block over there and I can execute that by clicking on that play button it gets executed I am not going to use collab in general I will be using the locally installed Jupyter Lab environment.
So I'll show the same piece of code on the local Jupyter lab. Here it goes. So I open up Jupyter Lab and I have clicked on this sheet and I can write down that print same piece of code and I'm putting up my name. This is going to be faster for me. Right. It works. Hopefully 1 2 3. It does not. quite till now taking too long something is wrong with my machine maybe I'm acquiring too much of done great so anybody and everybody give that a try can you just take out that print statement and see if you're able to execute either in collab either in uh your environment whichever you are preferring I'm okay with that but just make sure that You are able to get the codes executed.
Great. Ainetry. So we'll start talking about the first library and that will be your first file which I'm going to rename over there numpy and I'll put up that is for your Jan or other this is your ADSP batch for January ADSP B1 that's batch one for Jan 26 or January that's fine remove. Great. So, let's start talking about numpy. So, what is numpy? So, numpy is essentially a framework or library one of the very basic or base library that is available in python or that's a part of python which is used for numerical computation primarily used for numerical computation.
So, numpy is a library of python which is used something from sang. Yes sir, I'm telling which is uh numpy is a library of python primarily for numerical computation. The word numpy is coming from numerical python. So numerical uh that's fine numerical python. So I just highlight those characters in upper case. Right? So essentially the idea behind the numpy was that I wanted to make sure that I can use the mathematical concepts of Python in an efficient manner. Right? It brings in what does it brings? It brings the concept of brings in a new data structure.
a data structure that is array. Now do we know what is the data structure? Anybody not data types it is a data structure. Now data type and data structure are slightly different in nature. Narendra collective data of different types not even of array is not of different types. a data sets are not even a data set either. So when I talk about a data structure, a data structure, a data structure actually defines defines the arrangement of data defines the arrangement of data in the memory. Let's try to understand that through a conceptual or graphical manner.
Very simple thing but I'll try to put that into a graphical manner. Suppose it's your birthday. Possible. Anybody's having birthday in the month of January. Oh, January is finished. February in the house. Suppose it's your birthday. Now, there is a locality, right? There's a locality where five of your friends are living. There are five friends of yours. Suppose this is the entry gate of that locality. This is your friend one's house. This is your friend's two's house. Right? This is your friend three house. This is your friend four house. And this is your friend five house.
Now the problem is that you know where is friend one. So you can reach out to friend one give him the invite. Friend one knows where friend two lives. Friend two knows where friend three lives. Friend three knows where friend four lives. And friend four knows where friend five lives. Good. Now if you think about this process, it is going to take up some time for you to go around with all the friends houses and distribute the invites. As compared to as compared to when I ask you the comparison if it is the situation like this that you have a friend one you know where is friend one but the friend 2 3 four and five they are living adjacent.
You know that friend one lives at a particular place. You will go up to the friend one and then you know next house is of friend two then three then four then five. Now definitely you will take up less time in this scenario isn't it? So that is what array offers. So array is a arrangement of data into the computer's memory in a contiguous manner. Contiguous means in a single chunk. So whenever data is arranged, right? So what is an array? That is what numpy offers. an array which is referred as ND array. The word that is used in Python is ND array.
Right? We use the word ND array in Python. So referred as ND is a contiguous contiguous memory allocation of the data of same type. Now idea is that every information will be of similar nature and it will be arranged in a contiguous manner. Contiguous means that one after the other it will not be scattered around in the memory but it will be together in single char. Sensible, not sensible. Yes. No. Maybe you need to ask questions. Now every time when I start with numpy and I say that it is used for numerical computation people say that python has its own module for numerical computations like math then why do we require numpy so that's the next basic question that is why why numpy so what is the numpy because of the use the arrays and its functionalities, right?
Its functionalities. Numpy is NumPy offers much faster execution that means it is intended to be very very fast good that is the only reason I require numpy then the core python let's try to look at something now first of all before I begin with this how many of you know what is an import statement import keyword anybody body have ever used import keyword before? Yes. No. Maybe. Yes. Nish. Yes. Gilbert. Great. Yes. Yeah. For importing. Yes. To use the library. Thank you very much. So almost everybody knows it. Hoping so. Now considering that let I'm going to import few things now in front of you.
Right. I'm going to import a library that is called as import. Ah, I'm going to import just correct that it's raw. We get code. Let's import time. One of the library which is the default library to Python which is time library. I'm going to use that library. Why I want to use that library is because I want to showcase something. Great. What I want to show is this. If I just talk about time dot time is a library that I'm using dot time and I'll try to print it up. Let's print what is the time dot time function is going to give me.
Now it gives me a epoch time. What does it tells me? It prints the epoch time at execution. Right? What is an epoch time? Somebody help me. Present time. No. Unix time. Yes. But what essentially that means Unix time narendra. So epoch time if I talk about is the time that is elapsed in seconds since January the 1st Jan 01 1970 so that is called as an epoch Right. Epoch is another word that is used alternatively as you know Unix time or Linux time. Uh essentially that was a period when Unix was introduced and the clocks were reset to be standardized for you know a standard reference.
So it is you know kind of you know something of that we follow in the computer science fraternity to you know keep a hold of time as a fixed things across everyone in the entire globe because time is something which is varies across the globe you know every geographical location I am currently right now it's almost like 11 uh you know in the morning or early afternoon you can say that 11:00 a.m. is the timeline for me. Some of you might be at different time zones, isn't it? For some of you, it might be early evening.
For some of you, it might be the early afternoon, maybe late afternoon, some other right, isn't it? Depending on the time zones that we follow. So in order to standardize that we use a particular timeline on the machines and that is we call as the epoch time or Unix time or Linux time. Great. Now what is the advantage over there? Now since I have executed this particular statement right there is some time elapsed isn't it? Let me just try to copy the same statement again paste it back again. Good and execute. Can you notice that there's a difference in the two outcomes?
Right? 1769836489 1769836649 or essentially if I can say that between that two executions I have there was 159.5690 seconds elapsed this is a difference between the execution time Right? Two statements I have used and I have tried to you know showcase the difference between the time of execution. Are we good? Now I'm going to utilize this. For what purpose? The purpose is to tell you why numpy. Good. Great. Yes. No. Maybe. Now I'm going to use out a data structure over there. just to showcase this part which you will learn about in a due course in upcoming time maybe today itself or tomorrow that is going to come up right but I'll start talking about this part right and that is the a random thing so I'm going to create an array the idea is to let's create an array create an array of random data Create an array of random data, Right.
So how will I do that? Since I am using that, you can use that in uh you know syntax for yourself as of now. Do not put into your brain for this. Just think of that as a syntax. Okay? And I am expecting everyone is going to do that for me. Right? I'm going to create an import library import numpy as numpy. Numpy I'm going to put that as a name np. What essentially means that I am importing the numpy library with an alias name. Thank you very much Narendra. And now I'm going to create up a data.
So let's say data is equal to np dot random dot rand. And I'm going to use uh let's say 1 1 2 3 4 5 6 7 eight zeros. So what I want to do it is to ask my numpy to generate a random values of what nature of rand nature. Now rand means a random floating point numbers between the range 0 to one. We'll discuss that rand function later on. I'll do that. But as now consider I have a floating point numbers which are you know decimal point notation numbers that will be between the range of 0 to one.
Good. I'll have that many numbers. Good. It generates that data. Good. The data is now generated. Now if I ask you that I want to calculate the average of this. A very simple thing right? There are that many number of data points that's 10 100,000 10,000 100,000 1 million so that is approximately 1 billion good 1 billion numbers if I want to calculate the average of those 1 billion numbers how will I do that I need the summation of all those agreed what is an average take the sum of all numbers Right? Divide by the count of numbers.
Is that okay? That's average. So let's take a sum. Sum is equal to or let's say I'll define that average is equal to whatever the data that I have. So I'll take up the summation of that sum of AVG. That is going to give me the sum of not AVG but the DATA. I'm taking that sum divided by the count of but the count is not available the length of da good or alien of da is going to give you the same data if you just let me just show you that number right same number so I'll calculate the average over there with this function good now I'll try to do what I'll try to note down the time.
So I'll take up a start time that is equal to time dot time. So that is going to capture the time that is elapsed since epoch before the execution of this statement. Good. And then I'll copy the same thing and I'll put it down below and I'll put that as a word stop and I'll write down time again. So stop is going to capture the time immediately after the execution. Agreed? Thank you. Let's try to display what is the time taken. So can I put a print time taken is equal to and I'm putting that as the stop time minus the start time.
Correct. Everybody okay with this till now? Thank you. I'll execute that for you. It's going to take some time. Let's see how much time it takes up. It is going to be machine dependent. My machine will take some time. Your machine might take some different time. But it takes me 12.69 seconds. The difference that I got is 12.6994. So approximately 13 seconds. You can say that. Good. Now I'll copy the same piece of code. Right? No changes at all. Apart from how I am going to calculate the average. I'm changing the process of calculating the average.
Instead of using the you know the traditional approach, I'm going to use a numpy library approach. I will ask np.m me. Now that's a numpy function to calculate average of a data and I can put up that I want to average of this data which is by the name data. Good. And look at the time taken 0.42. Do you notice the difference right now? Some of you guys, some of you, I'm not expecting all of you, but some of you are going to tell me how much time on your machine it took up without numpy and with numpy.
Some of you will tell me that will confirm that everybody is doing along with me or not. This is just for that purpose not because what I'm expecting is that you guys will do along with me. I have not yet started with numpy. I'm still trying to you know talk about the advantages of numpy and so on. No one and no from myself. I'll wait. I have time. No problems. I'll wait. But I want you guys to practice. And I insist. Guys, give that a try. If you're feeling not comfortable with the code, I will you know show up whatever maximum possible maybe you might require this line as well.
Paste up the results. Uh Ashai the time before it took up and time after. So Rosie it took up 0.013 01 and 0.00 potentially Rosie is having either a very good machine or she's using Google Collab. She or he is using Google Collab. I'm not pretty much sure. I cannot capture with the first name. Is it a he or a she? Sorry for that. Now that can be present as a rosie and can also be pronounced as rosé. So slight confusion. Not a problem. I am not gender biased. It's anything. I'm okay with that. But good potentially what I can inference from that either you have a very good machine or you're using Google collab servers if I'm not wrong.
Can you confirm again data start off with length 10 pri has tried to use no service slightly and utilize these things but yeah you can still notice the difference in the time isn't it Right? You have used a small chunk of data that is why the time taken has not too much of difference but there is a difference right. So essentially what happens is because of the numpy functionality right I can use or I can perform task in a faster manner as compared to the traditional approach and that is why people prefer using numpy and not using the functions uh not using the default or core functions or core python part core python is good we need to use certain things from code python it's great but yet you would require libraries to do work with this now does anybody require help installing numpy onto the machine especially to the people who are using VS code and not able to extract numpy anybody not able to execute any of the piece of codes that I have discussed so So suggest some system for data science akshai typically that's difficult to gather for me what kind of system that you're looking for thank you very much narendra on that that part install minimum requirement see there is uh even if you have a very basic machine right you have a basic machine that allows you to you know browse internet over any period of time not a problem what you want I want you guys to have a good browser right and you can still use Google collab I'm not saying that you need to have a locally installed software not necessarily you can use the cloud softwares the point is we need to be a little bit more you know conscious with them because they lose out on the data I need to keep a local copy of those data So a good a simple average machine where any simple average machine like let's say you can have a 4 GB of RAM with any simple processor I'm okay with that but make sure you have a good internet speed right if I talk about my machine right now I'm working on currently on 200 megabytes 200 Mbps connection right now that's the maximum available in my area if I would have some more options I would have gone with that.
So good internet speed works well provided you have an average machine which is good enough to play you know videos watch out anything I'm okay with that. So nothing specific from my end a minimum requirement but yes something that you can have that allows you to do a proper you know proper without lag functionality I'm okay with that 2 GB of RAM is also fine with me I'm okay with that provided your browser works well great now comes the first aspect that is the array now before I move on to the arrays can Someone tell me the list.
Anybody heard about the word list before list in Python? No. Great. Okay. Heard about List in other languages? Now data structure an ordered mutable collection that stores multiple values in one variable. Thank you sesh. So essentially understand the idea Python offers a data structure. Data structure is an arrangement. Right? It offers a data structure which is called as a list. Now list can contain any type of value. Right? I can have a integer value. I can have a floating point value. I can have any sort of I can have a string. I can have any boolean type of data.
The point is when the list works, what does it do? It tries to store your data into the memory. Now, it does not store that into a contiguous manner, right? It will try to store integer value somewhere, a floating value somewhere else or another value somewhere else, somewhere else. Now whatever the combination it can be you know continuous it may be continuously together it may not be together it it varies machine to machine right wherever the memory is available a list will store all data points accordingly now however the arrays allows me to store the same information in a in a contiguous manner that means that essentially if I have four or five or 10 number of values uh a array will allow me to store the data in a continuous manner like this.
I have one 2.4 let's say letter A and true. But there's a catch. The catch is with list every individual element right of that data structure will keep its data type. That means if something is integer that will remain integer. If something is floating that will remain floating. If something is string it will remain string. And something is a boolean value will remain boolean. However with the arrays the data type changes. That means it is going to be throughout the array. Every element is of same data type. Every element of the array is of same data type.
Are we So what is an array? So an array I've given you the definition earlier too. An array is a arrange data arranged data in memory right a continuously arranged data that's a simple array numpy offers numpy has by the name or that's on numpy addresses. Let me just put that as addresses arrays as the name the name is ND array which refers to n dimensional array which refers to n dimensional array. What is the idea behind it? So the arrays could be in multiple number of dimensions. When I say dimensions, what does it mean?
It means that suppose I have a single line of data. It can be horizontal, it can be vertical, does not make a difference. I call that as 1D, one-dimensional. If I have a table like this, I have rows and I have columns, right? Like this, I'll say that as two-dimensional. If I have a threedimensional data like I have rows and columns like this behind that I have another layer like just like you can say that a Rubik's cube right you can think of a Rubik's cube or any threedimensional object right so if the data is arranged in that format I'll say that as a threedimensional data or hypothetically you can think of four dimension five dimension fifth dimension these are not pictorially representable but imaginary right but yeah we can represent them in terms of machine.
Great. So, Python offers two ways. There are two ways. There are two ways by which the arrays can be created in Python. Right. What is the number one way? Using the def using the array function. There's a function called as an array. And then there is using some using the built-in array generative function. There are a lot of many of those. So I will not talk about them in uh in general. I'll try to talk about them one by one. Good. So let's try to create arrays. Let's create arrays. Create nd array rather using array function.
Great. Now the first one that we have in the picture is let's create a zerodimensional array. Now what is zero dimension means input stream. What do you mean by zero dimension? When you say the word zero dimension, anything strikes back. Yes. Does not exist. No, it does exist. Priy a zero dimension does exist. Empty array. No ro uh rosi roishandran empty array I will yeah you can say that as zero dimensional but uh that indeed does not mean the same thing understand what is do we know what is the difference between a scalar data and a vector data I will though talk about scalar and vector in detail later on that's a separate thing but what is a scalar data and what is a vector data A scalar is without direction.
Great. Thank you very much. Direction means a dimension. Understand it. Suppose if I think about a coordinate system. Suppose this is a xycoordinate system right and if I put up a point anywhere in this xycoordinate system right let me put up a point trying to take a boulder pen suppose this is the point now this point if you do not talk with reference a single point I've talked about if you do not talk about this point with reference to any point right if I talk about where is this point from this location right that is a vector right it is a vector when I'm talking about the de the location of a particular data to a reference right there is some length and some magnitude both things are available some magnitude and some kind of direction available able to the data somebody's talking about positive, negative, northeast, northwest, whatsoever it may right I'm not talking about that but some direction then I'll say that as a vector quantity if it is not vector right it is some data right or something uh that you can think of which is directionless think about your height For example, your height.
Suppose I personally talk about myself. I stand 182 cm, right? I stand 172 cm. Now, if you talk about my height, if you measure it from my head to my toe, if you measure it from head to toe, you put up the scale from head to toe, I'll get 182. If you put it up from toe to head, I'll still get 182. Does it make a difference? That's scala, right? Direction does not make a difference. How do you measure it? It does not make a difference. Now, let's talk about gravity. For example, the gravity on the earth, suppose this is your earth.
And the gravitational pull that we have is 9.8 m/s squared. Right? I'm talking about very standard basic figures. Right? So if something is attracted towards the earth, it is coming at an acceleration speed of 9.8 m/s squared. Agreed? Now if something is going away from it then I do not have the acceleration. We call that as the word deceleration, right? But that is nothing but - 9.8 m/s squared. Direction changed, right? The magnitude remains the same but the direction stayed. Here it was adding up to the things here it is retracting from those things. Make sense?
So direction changed or you can say the force, acceleration, velocity these kind of entities which are direction wise these are called as the vector quantities. Are we good? So zero dimensions data a zerodimensional data or zero dimensional are those that do not have any direction right and are created using scalar value. Okay. So how will I put it up? Very simple thing. So I'll name that as a ar r0 get is equal to I'll use numpy library dot the array function. As I said that here using the array function. good nper and I'll just put up a single scare value let's say put up five I put up a single number five so I'm asking it to create up a numpy array which is a zero dimension and uh so what I'm asking it numpy please create an array and use this data this data is in no dimension I'm just putting up a scalar value good it creates up an array you might not agree agree to this.
So let's first of all print that value a r0 d. I'm going to print that data. I'm going to print the data type of this data. Print the type of this data. If anybody is not comfortable with any of the function that I'm putting up or using, let me know. If you do not ask it, I will not talk about it because I'm this is the some basic functionalities just coming from the very basics of Python like type function and print function that I've used quickly. Done. You can see two results on the screen. Confirm if they're visible and you have questions on them.
A R R O D. Where did I use it? It's not OD. It's a zero D. that I've used and that typically is a variable name that I've taken up. You can take up anything. You can take up your name instead of that. If you do not like that particular part, you can put up your name as if you want ASF, I will put up ASF over there. You don't like it, I can put up as if it works well. No problems. It's just a variable name. that is our choice. It has to be a valid name as per the Python documentation.
That's it. Right? But I've just kept that as a ar r0D so that it becomes you know understandable that I'm creating up a zero dimensional array. That's the idea that is the only one idea right. So at a later stage when you were going to look at the codes you would get to know that it's a zero dimensional array. Everybody able to get that as a numpy zy eyes nose maybe nd but did it is it zero dimensional how will I put it up I need to know the number of dimensions isn't it same array I can use another function this is a numpy function so please remember what is a ar r0 it's a numpy array it offsets me a lot of functionalities one of the functionalities is to know about the number of dimensions it has right so I want to know a ar r0 the number of dimensions nm that gives me what the number of dimensions for a particular array.
So this is your array and I want to know the number of dimensions of it. I want to print that up. So I'll just put up a print function before it. Print the number of dimensions. Good. Can you see zero? See guys, I want you guys to code along with me. If you want me to take a pause, I'll pause it up. If you want me to wait, I'll wait for it. that I am trying to write down the piece of code. I am fast and not able to go along with me. I will wait but confirm that you are getting also the same results or similar results.
If you're getting any kind of error, if there is any issue, any problems or anything, let me know. I'm here to help you out. No, I will not do it. I want you to look at my screen, type it down and then do There is a deliberate reason behind it and I'm being very blunt on this because I wanted to make learn and not understand how to do a copy paste. Right. One will take a pause. Why we cannot use a rand npend ar of zero? See the idea is slightly you know different into that.
Do you understand the concept of clauses and objects? Now that was a specific question coming from Brahand right basic understanding. So the idea is that this property right endm is a class attribute right like when we create up a class we have an attribute called as endm and then if you talk the way you are talking about you're talking about there is this function right you're talking about the way I'm talking about that I am trying to write down a function called as endm followed by an argument of the array. Right? So that is a method.
Right? If I have a method by the name end, I can call that method passing an argument data. Right? So there is a difference between a class attribute and a class method. So here end in Python with numpy library is given as a class attribute rather than a method. There are certain things which are methods. I will use them as methods. But there are certain things which are as a class attribute. I'll need to use them as an attribute. Now here you should know what is a class attribute. That's the basic idea. Thank you. Again team I'm okay with 2 + 2 is equal to 4.
But ask it. If you do not ask it, I can not get to know. But right, can I move on to the next attribute or next property? Yes. No. Maybe quickly. Yeah. Thank you. So, next property that I want to talk about is the shape. So, same thing I've just copied and pasted back and I'm writing down the word shape. Now, what does it tell me? Now listen to that definition very clear clearly because this is going to be a very very important attribute that you will have to use multiple number of times at multiple number of places for multiple number of reasons.
Right? So shape is one of the very important attribute. Right? Very important. So you need to understand that very clearly. What does it talk about? It tells you the number of elements in each dimension as a tuple. Right now can you tell me what can be the expected output from the information given by me? Zero. Priti says zero. I tend to disagree. Anybody else? Priti, your approach is not wrong. But the way you have interpreted the answer is not exactly the way it should have been. Narendra says nothing with a round brackets zero itself of any three.
No, it's not going to be zero again. Yeah. You mean an empty tpple? I agree with that. Zero is not an empty tuple, right? not square brackets for all. Yeah, round brackets. What I want is that it is going to talk about the number of elements in each dimension. Now, how many dimensions do I have? Nothing. So, there is no dimensions available. So I cannot count any number of elements in any number of dimensions. Right? So I what I'll get is a tpple that is having nothing. A tpple without nothing means an empty tpple. An empty tpple will look like this.
Are we good? Sensible. Thank you. Let's talk about the next property size. And I'm going to give you the definition for size too. It gives the number of element. Gives the number of elements in the array. Now what should I expect over there? Arrays are denoted by square brackets. Uh see arrays are denoted using square brackets. Agreed? But the point is uh I'm not denoting the array. I'm denoting the shape of that array. If I have to print that array a r 0 the number of square brackets I'll come to the square brackets concept in a short while.
Someone has let me just scroll back up. It was kunal. So kunal I'll come to the concept of square brackets in terms of python in a short while and I'll talk about 1D array. I'm still stuck at zd right so just hold on I'll talk about when the square brackets comes into the relevance what is the purpose of square brackets in terms of arrays what is the significance does the square brackets hold up everything will come up but I need to put up you know you know the right path so coming back to the size now when I talk about size talks about the number of total number of elements elements possible in that array.
Now here I have only one element so I'll get the answer as one. Almost everybody was wrong or everybody was right. Next properties I want to talk about is a very basic property is called as the DT type. Now what does DT type tells you? It talks about the data type of every element in the array. Now, some of you would be getting in 64, some of you would be getting integer 32bit 32, right? Let's have a look. I I've got in32 over there. Anybody got in 64? I am expecting that from the Google collab users right and 64.
Now what is the difference between that? You're using a local Mac. What is the data type that you got? D type Shashodia Narendra 64. I'm okay with that. Great. Now what does that mean? Any idea? What is that? That in32 means it means that the machine has stored the data as an integer of 32bit. Interview question team. Let me ask it. What is the default size? What is the memory alert? It's memory allocation size. Memory size of integer and or let's say integer 32bit in Python. Now you see that that I have given up a word.
I have said that what is the memory size of integer 32-bit in Python. Now you might say 32-bit but that's not right. It goes like this that by default when it is 32bit right. Python takes it at not as 32bit but it takes up that as 28 + 4 that means it is allotting 32 28 bits to allot the data and four bits are incremental. That means if a number can be accommodated in 28 bits it will accommodate in that. If it cannot it will use next four bits for this. If it cannot be accommodated into that it will increase that by four bit.
Is my screen not visible? A is not able to see it. Rest of the team you can see. Sram thank you. So, Python is you know kind of a language that you know does not allow or or it allows me to avoid data usage or data leakage does not happen with that. For example, let's say if I talk about a let's say I'll put up a number a is equal to 999. 4 * 9 works well. Print a I can see triple 9. If I increase that to any number of nines, I still get that same number.
If not okay with that, I'll copy that and paste it up multiple number of times. I'll still get the same number. That many long values are not supported in other programming languages, but Python does it. What it says is that that I'm willing to extend your data structure. Willing to extend it. I'm going to give it a default value. There is a library uh that I can use that is a cyst library. I'll just show it with that. Let's put up import syss. How much memory takes up? For example, if I put up here syss dot size of Okay, great.
Very simple function. Sys dots size of all right. Uh I want to get it up. So get size of y and let's print it up front. Now I want you guys to concentrate on here the number of data points that I'm going to use. Look at this. You will have a great knowledge on this. I'm putting up 9,999. Good. What does it tell me? What is the size here? 28 bits. It is in size in bits. Let me increase one more line. Still 28. So that many number of data can be accommodated in 28 bits.
If I put up another nine, 28. If I put up another nine, it's still 28. Another nine, still now it becomes 32. Make sense, right? So whenever this data cannot be accommodated in 28 bits, it increases that by an incremental value of four. Make sense? Why? Why four? Because my machine is 32bit. In 32bit, it is going to increase by 4 bits. In a 64-bit, it is going to increase by 8 bits. And it's going to not start with 28. It's going to start with 56. Make sense? Now, if I just put that number, let's say double it up.
I'm just putting the same number. You can say it goes up to 36 bit. AX Sharma rejoin because many all the other learners are able to use and see my screen. So it has to be an issue at your end. Please a then it has to be something at your end. You need to check at your end please because it is nothing from my end. Every other learner apart from you is able to see my screen. So something that you might have disabled around or maybe something that is causing that problem you might have put up you know hide screen or hide whatever sys function is size uh see syss is a library as if that's a default library to python that is used to know about the system interactions that means how is the machine interacting the hardware component part right so it's a library it has multiple multle number of functions.
One of the function that I have is get size off that talks about the amount of memory or hardware memory that is taken up by particular data. So get size off gets me the memory in terms of bits which I can see over there not in bits but in bytes. Are we good? Thank you very much. Now very common question. Now had that been a 64-bit integer same thing would have varied. Those who are using 64-bit machine you would have seen that I have 36 over there you might have 72. Same example same data you would have 64 or 72 No it is not starting with 28.
It starts with 56 because for 64bit it is 56 + 8. 8 is the incremental term. For 32bit it is going to be 28 + 4. I in 64 I am getting triple line is 36. Uh not possible. 64 bit does not start with 36 bits. Not possible. Kunal data used is 28. For me it starts with 28. See that is a separate thing individual machine wise. Punal hold on. See see it is individual machine wise things. You might think it is 32bit or 64bit. I'll talk about individual machines if you require but that's not the cl that's not the point.
The idea is that I want to convey is that what your machine is going to be how it is going to take up the data. Either it is going to be a 32-bit data or a 64-bit data. That is the main concern does not matter. It does not make an impact at the end of the day as of now for you. As of now, it will make an impact when you're dealing with you know bigger corporate clients where every single bit of data isn't important right things you want to you know save out on even a single bit of memory.
Now optimization of the project is a concern. You might require that information at that stage. So I just given that as an additional information to you guys. Get the size of integer. There is a size there's a concern with the size of floating point. There is a concern with the size of the strings. I am not going to talk about that at all because that is going to take me long time. But what I'm trying to bring in is the perspective where you can you know ex you know extrapolate your knowledge how you can utilize your time after today's session coming up to tomorrow's session and have multiple more multiple more number of questions for me right giving you something new to explore hopefully are we good next thing I'm going to talk about is another property into the same array the zero dimensional array and that is the item size give that a look team item size.
What is that item size? Talks about the amount of data or space allotted in bytes. So it has given four bytes of space. Those who are using 64-bit machine would have had the value is eight. Good. Confirm. Everybody okay with this? Sir on my machine size of is 32 and item size is 83 I need to have a look into the machine because there will be a lot of things to consider but what I have told you about is standardizing either for 64-bit it should be eight but if there is a disconnect then there should have been a clash between your machine operating system size and the Python installation price, right?
Maybe your machine is 64-bit and you have installed a 32-bit Python or the vice vice versa, right? If there is a, you know, a disconnect between the uh, you know, version at times what what happens is people install okay, they think that my machine is 64-bit and they install a 64-bit Python but at the end of the day their machine is 32-bit only. So there is a no clash happens. So some certain things will work on 32-bit, certain things work on 64-bit. That is going to happen. It is going to happen, right? Nonetheless, let's try to talk about a vector quantity now because I'm starting with 1D array.
Let's talk about a data point. Till now I have seen a value five. I have just given a number five. I did not tell it what it is in which direction it is where it is where it is from. Now in my coordinate system right this is your x-axis this is your y-axis right if I have to refer a point let's say this one this is three on x-axis let's say four on y axis get so that is means that I'm moving by three data points on x and I'm moving my four data points on y then I'm reaching to this point make sense from where from my origin which is 0 0 Third agreeable yes or no.
Thank you. Now that means from my origin that is into some direction and have certain length acceptable. Now if I have to represent this point can I say that that is x it has a value on x ais it has a value on y-axis that means I have two terms at least x-axis holds a value three y-axis holds a value four correct or can I say that this is individually a scalar value this is also an individually scalar value but I combined them together to make up a vector vector value isn't it? So when I combine multiple scalar terms it becomes a vector and that's what I'm going to do over there for 1D I'm going to create up a combination of multiple vectors.
So let's take up a vector quantity. I'm going to take up a list 1 comma 2a 3a 4a 5 a simple data right a very simple data 1 comma 2a 3a 4a 5 a simple list that is 1 2 3 4 5 values and I'm naming that as a a r1 d and I'm not going to change up anything else apart from the variable name and I will request everyone yes sa tell me lsm is would be available But uh if it is a video issue, you can let me know. I can see some responses coming through.
A you'll getting a call in a short while from uh a call or connection from coming from Andra. Great. So what I can see here is are some responses. Let me just quickly have a look. Okay, here it goes. Uh sam got someone sam has 1 2 3 4 5 class numi nd array comma 1 5 comma 5 integer 32 and 4 then 5 4 3 2 1 4 whatever the number is that does not make a reference to me 8 bits 8 bytes okay 1 2 3 4 5 class num and array 5a 64 I'm okay with kalsam is okay I'm okay with that uh again quot is okay I'm okay with that too so most of you getting the correct answers is expected but the idea is to understand or comprehend the results.
Number one, print 1D array. Now look at this. When it was a zerodimensional array, it was a z array, right? How many number of brackets do you see in the output? Square brackets. No brackets. Good. Now when it becomes 1D, can you tell me how many brackets at the beginning and or at the end? I'm seeing using the word or not and brackets either at the beginning or at the end. Number of brackets you have one right. So for zero dimensional arrays in display you will not get any brackets around it. It's still that is an array.
For 1D array you will have one square bracket around that entire data. When it becomes 2D you will get two brackets. When it becomes 3D you'll get three brackets. When it 4 get four brackets. So if you need to know about the dimensions of the data at all and if it is an array you just look at the starting brackets or the ending number of brackets. Whatever is the count of starting number of brackets or the ending number of brackets you can tell that that is the dimension of that array get it is a r 1d starting with one bracket so my number of dimensions is one how many dimensions do I have I have one dimensional so for the first dimension how many elements are there essentially means within the first bracket How many independent individual elements are there?
So in the within the first brack pair of brackets this is starting this is ending I have one 2 3 4 five. So within that first bracket I have five number of elements that is given there and since it is a tuple so I can see comma size gives me the total count that's the that's the memory size DT type and the memory size. Are we good? Anybody any questions for this? Yes. No, maybe confirm. Uh this is concepts comes from the tpple concepts. Uh what is a tpple? The definition of tpple, right? Suppose if I make a value for example, you know many people say that tpple is you know a value is within the pair of round brackets.
That's wrong. Right? Let's say if I make a triple T1 is equal to and I want to write down a single value a single value let's say if I put a P and I put that up within the pair of round brackets you're now what do you think it should be tpple isn't it is not going to be a tpple it is not going to be a tpple I'll tell you why be that why part but let me just show you The type of T1 it's going to be an integer look at this observable. Now the moment if I just change that to a comma right it becomes a TPLE.
Now what is the difference? The difference is try to understand for tpples it is not mandatory to use the round brackets. The mandatory condition is it should be a commaepparated value right I can write down let's say for example T2 is equal to 5 comma did I put up any bracket no yet if I just ask you to print the type of T2 it's a tuple good so brackets does not make a sense what makes the sense is a comma Right? So if there is only a single value and I still want to represent that as a tuple right then I need to put up at least one comma there are multiple values in tpple square brackets is must know no it's not mandatory if you need to take out multiple values let's say t3 not mandatory again t3 is equal to I can put a 1 comma 2a 3a 4a 5 that still will work as a top not a problem See square the brackets are not mandatory.
These are just you know notional. In case of tpples the round brackets are just notional. You do not require round brackets to create a dppel. It's just notional. Just to make it separate looking kind of thing from lists and so on. That's the only ideology behind it. Otherwise you do not require them to create tpples. You do not require round brackets. See I have not used round brackets on 1 2 3 4 5 I still yes with a list narrator yes you require square brackets because uh that's a fundamental definition of list the comma separated values within square brackets for tpple it is not the fun the fundamental definition fundamental definition of tpple is comma separated values that's it the use of round brackets is you know promoted by many people but it's not the truth Many people say that okay tpples is you know values which are enclosed in the round bracket.
No it's not. It is just comma separated values. Anything which is comma separated is by default a tuple. But if there is anyone else anybody else questions 1D array I have talked about endom shape size dtype and item size typically you will not see any difference. Say okay. Now I cannot comprehend that the two dimensional array. Now when I combine multiple scalar values I got 1D. So when I combine multiple 1Ds I'll get 2D. Right? So I'll take the this 1 2 3 4 5 again. I'll copy it. Pasting the same thing again but just changing the values to 11 12 13 14 and 15 and combining them together again as a list.
So if you look at this, this is a list of list, right? I have an outer bracket that is defining that I have two list in between list one and list two. And within that interior lists, there are five elements here and there are five elements here. Are we good? Changing the variable to 2D are supposed to reach out to a different place in this current situation. But if you can look at this part and tell me if you are okay with a ar r 2D or not. I'm not talking about anything else apart from creating the two dimensional from a list.
First of all just look at the starting number of brackets ending number of brackets. It's a 2D array. Hence I've got two brackets. Then that is your number of dimensions two. That is why in my tpple I have two values. It says in first dimension I have two data points. What is your first dimension? First pair of bracket. This is starting over here ending over here. How many elements? Element number one. Element number two. Good. So that is why I have two over there. Then what is your second dimension? That is your second bracket. It starts over there, ends over here.
Number of elements 1 2 3 4 and five. And I got five over there. Make sense? So what I want you to understand is how to read that shape output. Now in a similar fashion, I can create up a 3D array to a threedimensional numpy array. Great. When I combined scalar values, it became 1D. When I combine 1D values, it became 2D. So when I combine 2D, it will become 3D. Right? So I'll just put it up. Same thing. Copied paste it below. Good. And I'll put up a create a threedimensional array. That would be a rarity that you will be dealing with a threedimensional data at the beginner level but maybe you might be dealing with multiple dimensional data.
So you should understand what the dimensions are right. So I'll take up this 2D data that we already have had. I'll copy the same information paste it back again and I'll enclose that another pair of brackets. So this is one two-dimensional data from here till here. This is another two-dimensional data from here till here which is again enclosed as a single unit. So let me just put up as a reference a different numbers. 21 22 23 24 25 Here I'll make it 31 32 33 34 and 35 just to make the changes right and now you get the 3D information what I want to you guys to concentrate on the result of end result of shape result of size the D type item size is not going to change it's going to be same thing because I'm using the integer values right so not into this part but look at this it is an array number of dimensions is three first dimension I have two second dimension I have two third dimension I have five total number of elements is 20 which is a multiplication factor 2 into 2 into 5 get that value agreed Okay, thank you.
Now when it says that I have 225 shape part, look at the outermost bracket. This is the outermost bracket, right? Which closes over there. The number of elements that I have in that bracket is this. I have here till here. This is one element. This is your second element. Right? two elements that I have in the outermost bracket. Good. So, hence I have two over there. Then I will look into the second bracket. If you look forward for the second bracket right up there, this is the second bracket. Starts over here, ends over Number of elements one and two.
And hence I have the second two over there. Good. And then I look at the third bracket. Third bracket starts over there, ends over there. 1 2 3 4 and five. And I've got five over there. Is that sensible? Very critical for me for you guys to understand the shape parameter. How is the shape calculated? What essentially it means? and how it does talks about the real world information. Okay, thank you. Let's think up of a data. I'll not take the same example. Suppose there is a cuboid. Good. There is a cuboid that you have, right?
A cuboid looks like this. Agreed? I may be bad at drawing, so please pardon me on that. I've drawn up a cuboid. Now, there are three dimensions to this. I'll use a different pen. Okay. One is this dimension. The second…
Transcript truncated. Watch the full video for the complete content.
More from Simplilearn
Get daily recaps from
Simplilearn
AI-powered summaries delivered to your inbox. Save hours every week while staying fully informed.


![AWS Solution Architect Full Course 2026 [FREE] | AWS Solution Architect Tutorial 2026 | Simplilearn thumbnail](https://rewiz.app/images?url=https://i.ytimg.com/vi/J9R_huR5lDc/maxresdefault.jpg)






