首页 > 代码库 > Data Analysis with Pandas 2

Data Analysis with Pandas 2

1. pandas.csv_read() to read the .csv file. After read, it is automatically convert DataFrame

2.The DataFrame is the frame for Pandas. It is not a matrix. The first column is not the column name but the first row of data. Column name is different from row of data.

3.Pandas utilizes this feature to provide more context when returning a row or a column from a DataFrame. For example, when you select a row from a DataFrame, instead of just returning the values in that row as a list, Pandas returns a Series object that contains the column labels as well as the corresponding values

4.In the numpy, we use a[99,0] to present the 99th row of the matrix. In pandas, we only need to use a.loc[99] .And there is also a series of 100th row shows on the display.

5.A convenient dtypes attribute for DataFrames returns a Series with the data type of each column.

6.The process of selecting certain columns in all the columns in Pandas format. First convert the Dataframe format to a vector by using .tolist() function. Then loop the list to select the certain row which satisfy the requirement and append these rows into a empty list. In the end, convert the selected list to DataFrame format by using food_list[[list]].

 

 

Data Analysis with Pandas 2