Ali Rad
Ali Rad

Reputation: 88

Python Read CSV File By Pandas

I am using following python code to read csv file data :

import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
from sklearn import preprocessing
df = pd.read_csv("D:\Projects\BehaviorMining\breast-cancer.csv")

It returns error

OSError: [Errno 22] Invalid argument: 'D:\Projects\BehaviorMining\x08reast-cancer.csv'

I thought csv file has problem ,because some csv files has no problem with above syntax , but I didn't find any problem in csv file.

Thanks for any guides

Upvotes: 1

Views: 790

Answers (1)

skaarfacee
skaarfacee

Reputation: 311

Just use single quotation marks only or use 'r' raw string upfront and a single '/'. For example

df = pd.read_csv(r'D:\Projects\BehaviorMining\breast-cancer.csv')

Upvotes: 2

Related Questions