Difference between revisions of "Pandas"
Jump to navigation
Jump to search
Rafahsolis (talk | contribs) m (→Info) Tag: visualeditor |
Rafahsolis (talk | contribs) m (→Info) Tag: visualeditor |
||
| Line 16: | Line 16: | ||
df.columns | df.columns | ||
df.values | df.values | ||
| + | df.shape | ||
df.head() | df.head() | ||
</syntaxhighlight> | </syntaxhighlight> | ||
Revision as of 06:54, 21 May 2019
Install
pip install pandas
Read CSV
df = pd.read_csv('news_2019.05.10.csv')
Dataframe
Info
df.index
df.columns
df.values
df.shape
df.head()
Select 1 row
df.iloc[[1]]
Select 1 column
sumarys = df[['summary']]
# Or
list(df['one'])
dfToList = df['one'].tolist()
Select 1 cell
df.iloc[1][1]
# Or
df.iloc[1]['summary']