Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

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)
Comment

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
Comment

PREVIOUS NEXT
Code Example
Python :: check auth user django 
Python :: python for loop with step 
Python :: copy a dictionary python 
Python :: how to make a dict from a file py 
Python :: delete row if contains certain text pandas 
Python :: Format UTC to local timezone using PYTZ for Django 
Python :: python string find 
Python :: binary to string python 
Python :: get file in file zip python 
Python :: timedelta python 
Python :: python remove common elements between two lists 
Python :: overriding update in serializer django 
Python :: edit error page flask 
Python :: socket always listen in thread python 
Python :: subprocess.popen no output 
Python :: python series unique 
Python :: break in python 
Python :: pandas groupby and show specific column 
Python :: python funtion 
Python :: creating dataframe 
Python :: serialize keras model 
Python :: I have string index in pandas DataFrame how can I select by startswith? 
Python :: keep tkinter window below others 
Python :: python save variable to file pickle 
Python :: Could not find a version that satisfies the requirement ckeditor 
Python :: how to create a virtual environment in python 
Python :: SyntaxError: positional argument follows keyword argument 
Python :: numpy generate sequence 
Python :: How to install packages offline? Ask Question 
Python :: pip install mod_wsgi error 
ADD CONTENT
Topic
Content
Source link
Name
5+4 =