Strings Lists Dictionaries: .csv to Dictionary Conversion

Поділитися
Вставка
  • Опубліковано 6 жов 2024
  • In this video learn how to load data from a .csv file, convert it to a list of rows, and then convert that info to a dictionary...all from the comfort of your own home!
    NEED HELP?
    🆘 Watch this first and then let me know in the comments below: • Help Me Help You
    ❤️❤️ SHOW SOME LOVE AND SUPPORT THE CHANNEL ❤️❤️
    Click Join and Become a Channel Member Today!
    Channel members can get preferential comment replies, early access to new content, members only live streams, and access to my private Discord.
    ❤️ / @tokyoedtech
    Amazon Affiliate Links
    💻 My Laptop (Asus Zenbook 13): amzn.to/2H3DLbF
    🎙My New Microphone (Blue Yeti Pro): amzn.to/2HmjOgN
    🎙My Old Microphone (Blue Snowball): amzn.to/3j8magh
    🎶My USB Interface (Focusrite Scarlett Solo): amzn.to/3kqyo5m
    Other Affiliate Links
    ⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. www.kite.com/g...
    LINKS
    🗄️ GITHUB: github.com/wyn...
    💬 Follow me on Twitter: / tokyoedtech
    📜 Subscribe to my Newsletter: eepurl.com/dKgM8k
    📝 Check out my Blog: christianthomp...
    ⬇️ Download Geany Editor: www.geany.org
    LEARN MORE PYTHON
    ➡️Space Invaders: • Python Game Programmin...
    ➡️Snake Game: • Python Game Programmin...
    ➡️Pong: • Python Game Programmin...
    ➡️Space War: • Python Game Programmin...
    ➡️Intro to Python (for Java Coders): • Intro to Python for Ja...
    ➡️Space Arena - The Ultimate Python Turtle Graphics Game Tutorial: • Ultimate Python Turtle...
    LEARN MORE JAVA
    ➡️Basic Java for Beginners: • Basic Java 1&2: Commen...
    ➡️Intro to AP Computer Science A: • AP Computer Science Un...
    #python #strings #lists #dictionaries #csv

КОМЕНТАРІ • 30

  • @LovelyBanyanTree-kg8md
    @LovelyBanyanTree-kg8md 4 місяці тому

    3 years later and this is DIAMONDS. I would be baffled if your students havent succeeded in life

    • @TokyoEdTech
      @TokyoEdTech  4 місяці тому

      Cheers - I'm glad you liked it! Keep on codin'!

  • @camillecrisostomo-rubia4067
    @camillecrisostomo-rubia4067 Рік тому +2

    Thank you! This has helped me get an idea so I can start my project.

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      You are quite welcome - glad I could help!

  • @noahz3429
    @noahz3429 3 роки тому +1

    this was so helpful thanks Tokyo

    • @TokyoEdTech
      @TokyoEdTech  3 роки тому

      Glad you liked it - one of my better more informative lessons!

  • @VECT4GAMING
    @VECT4GAMING 2 роки тому

    what would you do for a longer file?

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      For larger amounts of data I'd go with a database.

  • @joaogodinho2029
    @joaogodinho2029 2 роки тому

    how do you still do that if you have a header on the csv file?

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      Skip the first row.

    • @joaogodinho2029
      @joaogodinho2029 2 роки тому

      @@TokyoEdTech how do you skip the first row? I tried next but it doesn’t work

    • @TokyoEdTech
      @TokyoEdTech  2 роки тому

      @@joaogodinho2029 I don't remember the exact code I used. But at some point there is a list with the data in it - after splitting. So iterate from index 1 instead of 0.

  • @mishka5169
    @mishka5169 3 роки тому

    Nice!

  • @LukaDonesnitch
    @LukaDonesnitch Рік тому

    how do I make it where a person inputs a name from the csv file and it counts how many times that name is in the file?

    • @TokyoEdTech
      @TokyoEdTech  Рік тому

      Which part are you having trouble with?

    • @aidandiaz3192
      @aidandiaz3192 Рік тому

      I too had the same question

    • @aidandiaz3192
      @aidandiaz3192 Рік тому

      Using your example above, if I wanted to find out how many names were in the dictionary, how would I impliment that into my code?

    • @LukaDonesnitch
      @LukaDonesnitch Рік тому

      @@TokyoEdTech I followed all the steps and i created a dictionary named tree_list, what i'm trying to do with tree_list
      • When the program runs the user will have a command prompt to enter a tree name, like this, Enter the tree name:
      • The user will enter the name of a tree such as Cedar and hit return, the program will look through a row I created called spc_common = info[3]
      • The program will look to see if the name Cedar is in that specific row and will return the number of Cedar trees in the row called spc_common = into[3] and return a number
      For example:
      You entered: Cedar
      Total number of trees: 20
      Zip codes this tree is found in: 10010, 10000, 11550
      Towns containing the largest number: Chelsea, Nolita, Soho
      When the code is finished I need it to print the information above.
      I have also created rows for the zip codes called zipcode = info[4], cityname = info[5], so in total I have 8 rows going from [0] to [8].
      I see you created a dictionary inside of a dictionary but it just prints your 3 rows name, birth year and role when you enter.

    • @LukaDonesnitch
      @LukaDonesnitch Рік тому

      @@aidandiaz3192 I don't know, I replied to you by accident. I deleted it and sent the question to TokyoEdtech

  • @nguyenjasmine3981
    @nguyenjasmine3981 Рік тому

    I love you