How To Create An Animated Bar Chart (Bar Race) In Python Using Plotly & Excel | Tutorial [EASY] 💻

Поделиться
HTML-код
  • Опубликовано: 11 ноя 2024

Комментарии • 16

  • @verma7723
    @verma7723 3 года назад

    Thanks. Your videos are really easy to follow & very helpful.

    • @CodingIsFun
      @CodingIsFun  3 года назад

      *I am glad you liked the video; thanks for watching and for the comment!*

  • @tongaib
    @tongaib 2 года назад

    Hallo Sven, this is pretty awesome. Thanks for helping me learn this cool tech #Winning

    • @CodingIsFun
      @CodingIsFun  2 года назад

      A pleasure! Thanks for watching and taking the time to leave a comment! :)

  • @Ravi-ln7hy
    @Ravi-ln7hy 3 года назад

    Hello Sven, Thanks for this interesting tutorial... how can I create secondary axis with line chart in this case...?

    • @CodingIsFun
      @CodingIsFun  Год назад

      Thank you for watching the video. Your questions are great, but finding the time to answer them is difficult. Kindly understand that I receive many requests for individual solutions or modifications. That said, you might want to join our Discord server ( pythonandvba.com/discord ) and post your question there. Thanks for your understanding. Happy Coding!

  • @mariaguadalupebarraganorti4839
    @mariaguadalupebarraganorti4839 3 года назад +1

    Hi, If I have to save it as a gif, how can I do it? :(

    • @CodingIsFun
      @CodingIsFun  3 года назад

      Hi,
      Unfortunately, this currently not possible with Plotly 😥
      One (not very elegant) workaround would be to use a free screen to gif software (www.screentogif.com/).
      Alternatively, I could also recommend you an easy to use a library called "pandas-alive".
      After you have installed the library (pip install pandas_alive) you could run the following example code:
      import pandas_alive
      covid_df = pandas_alive.load_dataset()
      covid_df.plot_animated(filename='example-barh-chart.gif')
      Further examples & the full documentation of the library can be found here: pypi.org/project/pandas-alive/
      Hope that helps you.
      Cheers,
      Sven

  • @GolightlyYeni
    @GolightlyYeni 3 года назад

    Hi, I followed as what you did, but each bar graphs are separated. When one is end and the other starts. The only difference between your codes and mine is the name of x axis.

    • @CodingIsFun
      @CodingIsFun  3 года назад

      *Thank you for watching the video* Could you kindly send me your code to:
      ✉ contact.coding.is.fun@gmail.com
      I will have a look at it and get back to you as soon as possible 👍

  • @sabzuski
    @sabzuski 3 года назад

    Would you be able to insert this into a streamlit?

    • @CodingIsFun
      @CodingIsFun  3 года назад

      Thanks for watching the video. Yes, that is possible (see screenshot & code below) 😀
      prnt.sc/1do7v1u
      import plotly.express as px
      import pandas as pd
      import streamlit as st
      import plotly
      # Read Data From Excel and store in a variable df [dataframe]
      df = pd.read_excel('data.xlsx', usecols="A:C")
      df.dropna(inplace=True)
      # Store each column in a seperate varibale.
      country = df['Country']
      sales = df['Sales']
      date = df['Date'].dt.strftime('%Y-%m-%d')
      # Create Animated Bar Chart and store figure as fig
      fig = px.bar(
      df,
      x=country,
      y=sales,
      color=country,
      animation_frame=date,
      animation_group=country,
      range_y=[0,1200]
      )

      st.plotly_chart(fig)

  • @punjaramborhade1701
    @punjaramborhade1701 2 года назад

    Instead of DATE if time is there say....
    10:12 (min:sec)
    10:15 (min:sec)
    10:20 (min:sec)
    then how to modify code
    i.e. date = df["Date"].dt.strftime("%Y-%m-%d")
    to what so we can see in similar way .....
    please answer...🙂

    • @CodingIsFun
      @CodingIsFun  Год назад

      Thank you very much for watching the video and your comment. Your requirements are well noted. Yet, I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you!

  • @steepehare6539
    @steepehare6539 8 месяцев назад

    How To Create An Animated Line Chart Race In Python ? Thanks!

    • @CodingIsFun
      @CodingIsFun  8 месяцев назад

      Thank you very much for watching the video and your comment. Your requirements are well noted. Yet, I receive many requests for creating individual solutions. As much as I want to help, I simply do not find the time in my daily schedule to develop & test all the different requests. I hope you can understand. Thank you! Cheer, Sven ✌️