The easiest way to install pandas — use pip:
pip install pandas
or download it from here
Creating a DataFrame in Pandas
Creating a dataframe is done by passing multiple Series to the DataFrame b > with using the pd.Series method. Here it is passed in two Series objects, s1 as the first row and s2 as the second row.
Output: p >
Importing data using pandas b>
The first step is to read the data. The data is stored as comma separated values or a CSV file, with each row separated by a new line and each column — comma (,). To be able to work with data in Python, you need to read the csv file into the Pandas DataFrame. DataFrame — it is a way of presenting and working with tabular data. Tabular data has rows and columns, just like this CSV file (click Download).
Indexing data frames with pandas
Indexing is possible with using the pandas.DataFrame.iloc method. The iloc method allows you to get as many rows and columns by position.
Indexing using tags in Pandas
For indexing, you can work with tags with using the method pandas.DataFrame.loc which allows indexing using labels instead of positions.
The above doesn't really differ much from df.iloc [0: 5,:]. This is because while the row labels can be anything, our row labels correspond exactly to the positions. But column labels can make working with data a lot easier. Example:
DataFrame Math with pandas
Computing data frames can be done using the statistical functions of the pandas tools.
| tr> |
The plots in these examples are created using the standard convention for referencing the matplotlib API, which provides the basics in pandas to easily create decent looking graphs.