Python MySQL SQLAlchemy Pandas Matplotlib Plot | Data Visualization in Python | SuMyPyLab

Sdílet
Vložit
  • čas přidán 22. 07. 2024
  • Learn how to plot MySQL Table Data using SQLAlchemy, Pandas and Matplotlib in Python. Fetch Data from MySQL table, store the data in Pandas DataFrame, Clean the Data, Add Calculated Field to the DataFrame, Order the rows of the DataFrame, and finally plot the prepared data using Matplotlib.
    * Chapters *
    #1 0:00 Introduction
    0:36 Requirements
    1:04 Installing sqlalchemy
    1:26 MySQL Table
    2:17 Establishing MySQL Connection
    3:46 Connection String and create_engine()
    5:11 read_sql() MySQL to Pandas DataFrame
    #2 7:04 Plotting Data
    13:29 Plotting Subplots
    data analysis and visualization for beginners
    data visualization lab
    #sqlalchemy
    #visualisation
    #datascience
    #dataanalysis
    #dataanalytics
    #matplotlib
    #pandas

Komentáře • 6

  • @haydnwebtech
    @haydnwebtech Před 7 měsíci +1

    Excellent tutorials, really informative, and I love the way you provide such clear explanations as it makes it very easy to follow along. Well done!

    • @SuMyPyLab
      @SuMyPyLab  Před 7 měsíci

      Thank your very much for your encouraging remarks. So nice of you.

  • @bennguyen1313
    @bennguyen1313 Před 7 měsíci

    My goal is to read a csv file, and on the fly add columns to a single plot.. They all share the same x-axis, but have different y-axes scales/ranges.
    But when I try to programmatically generate the axes, it has an error because I haven't declared an array of axes to hold the return of twinx():
    import matplotlib.pyplot as plt
    #Single canvas and axes in which all the data will be placed
    fig, ax = plt.subplots(1, 1)
    #Generate additional Y-axes and save into array for easy access
    for i in range (5):
    axIdx [ i ] = ax.twinx() #ERROR
    How can I create an array of axes so that I can easily access and configure a particular y-series (moving its legend, setting its color, etc)?

    • @SuMyPyLab
      @SuMyPyLab  Před 7 měsíci

      Thanks for you comments. I have got your problem on twinx(). Please give me some time, I will discuss this in another lesson.

    • @SuMyPyLab
      @SuMyPyLab  Před 7 měsíci

      Add the following lines just before your for loop.
      axIdx=[0,0,0,0,0]
      This will remove your error. By the way, as said earlier, I will make another lesson on shaing axis.
      Bye!

    • @SuMyPyLab
      @SuMyPyLab  Před 7 měsíci

      Try the following code as an example:
      import matplotlib.pyplot as plt
      import numpy as np
      x = np.arange(0.1, 10.0, 0.1)
      sine = np.sin(0.2 * np.pi * x)
      expo = np.exp(x)
      fig, ax1 = plt.subplots()
      ax1.set_xlabel('x')
      ax1.set_ylabel('Exponential', color = 'magenta')
      ax1.plot(x, expo, color = 'magenta')
      ax1.tick_params(axis ='y', labelcolor = 'magenta')
      # Sharing x-axis
      ax2 = ax1.twinx()
      ax2.set_ylabel('Sine', color = 'green')
      ax2.plot(x, sine, color = 'green')
      ax2.tick_params(axis ='y', labelcolor = 'green')
      fig.suptitle('twinx demo')
      plt.grid()
      plt.show()