pandas - reading data from csv files in python -


i trying extract data dummy csv file use inside tensorflow. dummy data has 2 columns: x (single feature column) , y (expected output).

x     y  11.0 13.0 23.0 33.3  ...  ...  , on 

right reading data so:

import pandas pd  dummy_data = pd.read_csv("dummy_data.csv", sep=",") inputx = dummy_data.loc[:, 'x'].values np.reshape(inputx, [11, 1]) 

i reshaping numpy array because need matrix multiplication later on linear regression want ask correct way extract column csv data? there better way directly extract csv data tensor object?

there no need reshape or use .loc or .values:

inputx = dummy_data[['x']] 

(mind list of lists [[]]!)


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -