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
@@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 ?
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
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 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')
Thank you heaps. This tutorial was more helpful than what my professor taught. Thanks again
Thank you for your kind words.
Thank you so much for the wonderful tutorial. Clear, logical, and useful!
You're welcome!
finally a helpful video!!
Thank you 🙂
Thanks a lott really helped me a lot!!
You're welcome Rakesh
Thank you for being helpful and positive
You're welcome
Thank you 🥺
You’re welcome 😊
youre a Hero
Thank you :-)
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?
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
@@StatsWire Thanks :)
@@sarthaknema1130 You're welcome
Very nice tutorial
Thank you
In the txt file only contains columns but not present any row ? What should i do and how to tackle this situation?
What error are you getting?
@@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 ?
@@akshaypatil6904 Does your CSV file has rows or not?
@@StatsWire no rows present 🥲 and client wants to run ml algorithm on it😢
@@akshaypatil6904 Haha, how is that possible? Without any data, we can't make any ML models.
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
Thank you Emeka for finding it useful
sir where did you take this data from .....can you pls send its download link
Hi Avani, here is the data link
link: github.com/siddiquiamir/Data/blob/master/iris_tab.txt
Thank youuu!
You're welcome!
Bro iam getting pd is not defined?? Errors like name is not found are coming for me
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
Does anyone know how to do with MacBook? All these tutorials are windows
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)
@@StatsWire sorry I can’t make sense of this
@@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')
But my error is coming
Can you please paste the error here so I can help you.
👍
Thank you