Home > Blockchain >  Python Read CSV File By Pandas
Python Read CSV File By Pandas

Time:01-29

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

CodePudding user response:

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')
  •  Tags:  
  • Related