Difference between revisions of "Pandas"

From RHS Wiki
Jump to navigation Jump to search
m
Tag: visualeditor
m
Tag: visualeditor
Line 7: Line 7:
 
<syntaxhighlight lang="python3">
 
<syntaxhighlight lang="python3">
 
news = pd.read_csv('news_2019.05.10.csv')
 
news = pd.read_csv('news_2019.05.10.csv')
 +
</syntaxhighlight>
 +
 +
== Dataframe ==
 +
 +
=== Select 1 row ===
 +
<syntaxhighlight lang="python3">
 +
texts.iloc[[1]]
 +
</syntaxhighlight>
 +
 +
=== Select 1 column ===
 +
<syntaxhighlight lang="python3">
 +
sumarys = news[['summary']]
 
</syntaxhighlight>
 
</syntaxhighlight>
 
[[Category:Python]]
 
[[Category:Python]]

Revision as of 08:24, 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']]