How to read TEXT file in Python Jupyter Notebook | Pandas

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

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

  • @tennysonfaria3751
    @tennysonfaria3751 2 года назад +2

    Thank you heaps. This tutorial was more helpful than what my professor taught. Thanks again

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

      Thank you for your kind words.

  • @visionalert
    @visionalert 2 года назад +1

    Thank you so much for the wonderful tutorial. Clear, logical, and useful!

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

    finally a helpful video!!

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

    Thanks a lott really helped me a lot!!

    • @StatsWire
      @StatsWire  2 года назад +1

      You're welcome Rakesh

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

    Thank you for being helpful and positive

  • @justisha5314
    @justisha5314 Год назад +1

    Thank you 🥺

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

    youre a Hero

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

    Why didn't you use read_csv?
    Also my text file is not properly arranged as in my data is not aligned under it's headers so do i need to adjust it?

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

      You can also use read_csv function to read your text file. Yes, first arrange your text file properly or pass some parameters and see if you get a nice data frame in the output

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

      @@StatsWire Thanks :)

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

      @@sarthaknema1130 You're welcome

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

    Very nice tutorial

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

    In the txt file only contains columns but not present any row ? What should i do and how to tackle this situation?

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

      What error are you getting?

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

      @@StatsWire No error bro, data imports fine . Data contained only columns but not rows . So how to know either data is correct/ incorrect or may be csv file ?

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

      @@akshaypatil6904 Does your CSV file has rows or not?

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

      @@StatsWire no rows present 🥲 and client wants to run ml algorithm on it😢

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

      @@akshaypatil6904 Haha, how is that possible? Without any data, we can't make any ML models.

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

    You are the best.😘
    When i use read_table it didn't allign well.
    I have to use read_csv then it gave me what i want

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

      Thank you Emeka for finding it useful

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

    sir where did you take this data from .....can you pls send its download link

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

      Hi Avani, here is the data link
      link: github.com/siddiquiamir/Data/blob/master/iris_tab.txt

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

    Thank youuu!

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

    Bro iam getting pd is not defined?? Errors like name is not found are coming for me

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

      No problem. First, you need to import pandas as pd so type
      < import pandas as pd
      If pandas is not installed then open your command prompt (cmd) and type
      > pip install pandas
      then type
      > import pandas as pd
      this will solve your problem

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

    Does anyone know how to do with MacBook? All these tutorials are windows

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

      Hello, please use below code to open a text file in macbook
      import os
      # Read in a plain text file
      with open(os.path.join("c:user/xxx/xx", "xxx.txt"), "r") as f:
      text = f.read()
      print(text)

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

      @@StatsWire sorry I can’t make sense of this

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

      @@Vintagetube310 I don't have a MacBook otherwise I would have tested myself and sent it to you. Can you try this code, that "r" is important in the function
      Automobile_data = pd.read_csv(r'Users/Spencer/Downloads/Automobile_data.csv')

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

    But my error is coming

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

      Can you please paste the error here so I can help you.

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

    👍