Change index.md for data-science-tools/Pandas (#30342)

Added applying functions & selecting data in Pandas
This commit is contained in:
Rahul Soni
2018-12-18 08:58:56 +05:30
committed by Christopher McCormack
parent 4ffab3310b
commit 2550fe5eff

View File

@ -147,6 +147,40 @@ right = pd.DataFrame({'C': ['C0', 'C2', 'C3'],
```python
left.join(right)
```
# Pandas Functions
## Information on Unique Values
```python
df['col1'].unique()
```
```python
df['col1'].nunique()
```
```python
df['col1'].value_counts()
```
## Selecting Data
```python
newdf = df[(df['col1']>2) & (df['col2']==123)]
```
```python
newdf
```
## Applying Functions
```python
def times2(x):
return x*2
```
```python
df['col1'].apply(times2)
```
```python
df['col1'].apply(len)
```
## Permanently removing a column
```python
del df['col1']
```
#### More Information:
1. [pandas](http://pandas.pydata.org/)