Answer the question
In order to leave comments, you need to log in
How to select desired data in Pandas?
I know that you can access data through column names:
import pandas
data = pandas.read_csv('name.csv', index_col='name')
data['name']
Answer the question
In order to leave comments, you need to log in
in a square bracket, you can specify conditions regarding values for a specific column, for example:
data = pandas.read_csv('test.csv', delimiter=';')
print(data[data.a == 0])
or
print(data[data .a < 500])
where a is the name of the column.
there can be many conditions:
print(data[data.a < 500][data.b >= 100]) and so on.
Or you can select several columns separately, and then stitch them together.
In [69]: from pandas import DataFrame, Series
In [70]: import pandas as pd
In [71]: frame = DataFrame(records) # records --> массив данных
In [72]: frame
Out[72]: 'структурированные данные' в виде таблицы
In [73]: frame['tz'][:10] # <--- ну а после как тебе надо делаеш выборку ---!>
Out[73]:
0 America/New_York
1 America/Denver
2 America/New_York
3 America/Sao_Paulo
4 America/New_York
5 America/New_York
6 Europe/Warsaw
7
Name: tz, dtype: object
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question