Difference between revisions of "Pandas"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) Tag: visualeditor |
Rafahsolis (talk | contribs) m (→Dataframe) Tag: visualeditor |
||
| Line 10: | Line 10: | ||
==Dataframe== | ==Dataframe== | ||
| + | |||
| + | === Info === | ||
| + | <syntaxhighlight lang="python3"> | ||
| + | news.index | ||
| + | news.columns | ||
| + | news.values | ||
| + | </syntaxhighlight> | ||
===Select 1 row=== | ===Select 1 row=== | ||
Revision as of 09:15, 16 May 2019
Install
pip install pandas
Read CSV
news = pd.read_csv('news_2019.05.10.csv')
Dataframe
Info
news.index
news.columns
news.values
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']