Python Forum
[split] Locate and open csv file
Thread Rating:
  • 2 Vote(s) - 4.5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Locate and open csv file
#1
Hello somebody, i am runung a code using anaconda the code is as follows:
import pandas as pd
import numpy as np
import random

from sklearn.feature_extraction.text import TfidfVectorizer
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import train_test_split

urls_data = pd.read_csv("urldata.csv")
type(urls_data)
urls_data.head()
where am i to insert the file named "urldata.csv" in the code above because it keeps telling me file not find, thks
Reply
#2
The file is expected to be in the same location (folder) as the script. If you want it to be in different location, then you need to specify the full path.
note that lines 10-11 will not produce any visible result. I expect you want to print these
Reply
#3
The file is in the same script folder yet it keeps giving me "file location not find" error, what have i not done right, thanks
Reply
#4
please, post the full traceback in error tags.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Split excel file and write output at specific row and set sheet position DSCA 0 1,960 May-12-2022, 07:29 PM
Last Post: DSCA
  How do I use bounding box to locate a table in a pdf file? JaneTan 1 2,450 Sep-01-2021, 05:44 PM
Last Post: Larz60+
  [split] Converting excel file to txt file unexceptionalhobby 2 4,312 Oct-16-2019, 06:34 PM
Last Post: unexceptionalhobby
  CSV file dont open with code ayaz786amd 2 2,572 Nov-21-2018, 09:13 AM
Last Post: ayaz786amd
  unable to locate package - pandas datareader Grin 3 6,203 Apr-12-2018, 11:43 AM
Last Post: Grin
  Open excel file using Python cioer23 8 19,389 Jul-26-2017, 10:57 AM
Last Post: Larz60+
  Access xlsm file that has been open ian 6 4,578 Jun-27-2017, 07:17 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020