Difference between revisions of "Pandas"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) m Tag: visualeditor |
Rafahsolis (talk | contribs) Tag: visualeditor |
||
| Line 19: | Line 19: | ||
<syntaxhighlight lang="python3"> | <syntaxhighlight lang="python3"> | ||
sumarys = news[['summary']] | sumarys = news[['summary']] | ||
| + | # Or | ||
| + | dfToList = df['one'].tolist() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
| − | === Select 1 cell === | + | ===Select 1 cell=== |
<syntaxhighlight lang="python3"> | <syntaxhighlight lang="python3"> | ||
texts.iloc[1][1] | texts.iloc[1][1] | ||
Revision as of 08:34, 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
dfToList = df['one'].tolist()
Select 1 cell
texts.iloc[1][1]
# Or
texts.iloc[1]['summary']