added example of using pandas.series (#30534)
This commit is contained in:
committed by
Christopher McCormack
parent
2550fe5eff
commit
867aeed209
@ -29,6 +29,24 @@ A data frame consists of a number of rows and columns. Each column represents a
|
||||
## Series
|
||||
Series is the basic data-type in pandas. A Series is very similar to an array (NumPy array) (in fact it is built on top of the NumPy array object). A Series can have axis labels, as it can be indexed by a label with no number indexing for the location of data. It can hold any valid Python Object like List, Dictionary, etc.
|
||||
|
||||
```python
|
||||
pd.Series([1,2,3])
|
||||
```
|
||||
output:
|
||||
```output
|
||||
0 1
|
||||
1 2
|
||||
2 3
|
||||
dtype: int64
|
||||
```
|
||||
```python
|
||||
np.array([1,2,3])
|
||||
```
|
||||
output:
|
||||
```output
|
||||
array([1, 2, 3])
|
||||
```
|
||||
|
||||
## Loading Data from a CSV File
|
||||
A `.csv` file is a *comma separated value* file. A very common way to store data. To load such data into a pandas data frame use the `read_csv` method:
|
||||
```python
|
||||
|
Reference in New Issue
Block a user