Skip to main content

Python Advanced- pyplot with Matplotlib

Another post starts with you beautiful people and today we will learn about Matplotlib library.
Matplotlib is a Python 2D plotting library which produces publication quality figures in a variety of hardcopy formats and interactive environments across platforms.
For more details about this library please visit here matplotlib library

Let's starts with plotting a pyplot for the example of stock I have given in my previous page of DataFrame. If you haven't seen that post please go to the side bar of the blog at right top most corner and see Python Advanced- DataFrame.

For a quick view I have a stock price data where I have done some cleaning as below-


Now I want to compute 10 days moving average of the stock data-

Next we need to import the required library as below-

Here %matplotlib inline displays our plot after every line of code.

Now it's time make a plot for our stock data-

See how a beautiful plot is prepared with some simple pyplot methods.

Comments

Post a Comment

Popular posts from this blog

How to deploy your ML model as Fast API?

Another post starts with you beautiful people! Thank you all for showing so much interests in my last posts about object detection and recognition using YOLOv4. I was very happy to see many aspiring data scientists have learnt from my past three posts about using YOLOv4. Today I am going to share you all a new skill to learn. Most of you have seen my post about  deploying and consuming ML models as Flask API   where we have learnt to deploy and consume a keras model with Flask API  . In this post you are going to learn a new framework-  FastAPI to deploy your model as Rest API. After completing this post you will have a new industry standard skill. What is FastAPI? FastAPI is a modern, fast (high-performance), web framework for building APIs with Python 3.6+ based on standard Python type hints. It is easy to learn, fast to code and ready for production . Yes, you heard it right! Flask is not meant to be used in production but with FastAPI you can use you...

Machine Learning-Linear Regression

Another post starts with you beautiful people! In my previous posts we have learnt the Python basics and advanced, statistics techniques for the Data Science track. I suggest you to please read previous post just for 10-15 min. before sleeping daily and then there is no any obstacle to stop you to become a great Data Scientist. In this post we will start our Machine Learning  track with the  Linear Regression   topic. I Have highlighted the both so please click on the link to know the formal definition of those. Machine learning-  More specifically the field of predictive modeling is primarily concerned with minimizing the error of a model or making the most accurate predictions possible, at the expense of explainability. In applied machine learning we will borrow, reuse and steal algorithms from many different fields, including statistics and use them towards these ends. Linear Regression was developed in the field of statistics and is studied as a model ...

Can you predict sales for a retail store?

Another post starts with you beautiful people! Hope you have enjoyed my last post about  kaggle submission   and you also tried to build your own machine learning model. To continue the same spirit today I will discuss about my model submission for the  Wallmart Sales Forecasting   where I got a score of 3077 (rank will be 196) in kaggle. Challenge : In this challenge, we are provided with historical sales data for 45 Walmart stores located in different regions since 2010-02-05 to 2012-11-01. Each store contains a number of departments, and we are tasked with predicting the department-wide sales for each store. My Sollution : To solve this machine learning regression problem I followed below steps- 1) load the datasets .  While loading the datasets, I ensured that required attributes only should be there in train and feature datasets. The important key feature which affects the sales of a store mostly is 'markdown' because this feature cont...