xxxxxxxxxx
import pandas as pd
# Specify the CSV file path
csv_file_path = 'path/to/your/csv/file.csv'
# Specify the columns to be read
columns_to_read = ['column1', 'column2', 'column3']
# Read the CSV file and extract only the specified columns
df = pd.read_csv(csv_file_path, usecols=columns_to_read)
# Print the resulting dataframe
print(df)
xxxxxxxxxx
import pandas as pd
df = pd.read_csv('some_data.csv', usecols = ['col1','col2'], low_memory = False)
xxxxxxxxxx
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