Answers for "read specific columns from csv in python pandas"

3

read specific columns from csv in python pandas

import pandas as pd

df = pd.read_csv('some_data.csv', usecols = ['col1','col2'], low_memory = False)
Posted by: Guest on June-11-2020
0

read specific columns from csv in python pandas

import pandas as pd
fields = ['star_name', 'ra']

df = pd.read_csv('data.csv', skipinitialspace=True, usecols=fields)
# See the keys
print df.keys()
# See content in 'star_name'
print df.star_name
Posted by: Guest on June-11-2020

Code answers related to "read specific columns from csv in python pandas"

Python Answers by Framework

Browse Popular Code Answers by Language