Difference between revisions of "Pandas"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) Tag: visualeditor |
Rafahsolis (talk | contribs) Tag: visualeditor |
||
| Line 20: | Line 20: | ||
sumarys = news[['summary']] | sumarys = news[['summary']] | ||
# Or | # Or | ||
| + | list(df['one']) | ||
dfToList = df['one'].tolist() | dfToList = df['one'].tolist() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 09:13, 16 May 2019
Install
pip install pandas
Read CSV
news = pd.read_csv('news_2019.05.10.csv')
Dataframe
Select 1 row
texts.iloc[[1]]
Select 1 column
sumarys = news[['summary']]
# Or
list(df['one'])
dfToList = df['one'].tolist()
Select 1 cell
texts.iloc[1][1]
# Or
texts.iloc[1]['summary']