Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » Forum » x-Forum » Question

How to import data and set columns from .csv in python?

I have a question about a code. I would like to ask you something abput a code. I have a .csv file with no header 10 columns with numbers (float). I would like to make calculations between 1st and 9th column, using an equation. How could I firstly set/declare each column ?? For example I would like to set the first column as "X", the second as "X1" etc.

I have written only this until now:



import pandas as pd
 
df = pd.read_csv('ALL.csv', usecols=[1,2,3,4,5,6,7,8,9,10,11], header=None)
print(df)


I am new in python and I need your help.

could you help me please?

For example in Matlab I set as :
 importdata('ALL.csc');
 X=data.(:,1).

In python?

Posted by mravnalis 2020-08-10 23:22:33

No Ans Posted

Please login to comment

Log In


Ask New Question