Tag:pandas
-
Method of statistical analysis of data by Python pandas module
1、 Groupby function The groupby function in Python is mainly used for datagroupingAnd intra group operations after grouping, which can also be used toExplore relationships between groupsFirst, we import the modules we need import pandas as pd First, import the data set we need customer = pd.read_csv(“Churn_Modelling.csv”) marketing = pd.read_csv(“DirectMarketing.csv”) Let’s start with a simple […]
-
Fundamentals of Python data analysis 005 – detailed explanation of pandas_ The introduction to pandas is enough
Article catalogue preface (1) Introduction to pandas Foundation 1. What is pandas 2. Why learn pandas 3. Installation of pandas 4. Import pandas Library (2) Common data types of pandas 1. Series (one-dimensional, tagged array) 1.1 index creation 1.2 create series through dictionary 1.3 slicing and indexing of series 1.3.1 display a value 1.3.2 display […]
-
Detailed explanation of the usage of iloc and LOC in Python pandas data analysis
Pandas is a fast and efficient data analysis tool for Python. It can be used for data mining and data analysis, and also provides data cleaning function. The contents of this part are as follows: 1、 Iloc 1. Definitions Iloc indexer is used to index or select based on integer position by position. 2. […]
-
[Python] use pandas to merge all excel in the folder
source code import pandas as pd import os #Target folder you want to merge target_dir=’C:/Users/Kinglake/Desktop/666/’ #Get the list of file names in this directory Print (“merge”, target_dir, “path file:”) for root,dirs,files in os.walk(target_dir): Print (“total”, len (files), “PCs”) #Generate absolute path for index in range(len(files)): files[index]=target_dir+files[index] #print(files) #Read in files and merge for index in […]
-
pandas DataFrame. Specific use of shift() function
pandas DataFrame. The shift () function can move the data by a specified number of bits The period parameter specifies the stride of the movement, which can be positive or negative Axis specifies the axis to move. 1 is the row and 0 is the column Eg: there is such a dataframe data: ? 1 […]
-
[pyecarts database and pandas database] use pyecarts database to draw the GDP heat map of China’s provinces in 2021 and the histogram of per capita GDP and population of five provinces with low GDP according to the GDP data in the table
Description of the problem solved by the program: Build China’s GDP according to the chart below Open the CSV file to display the relationship between GDP per capita and GDP of the five provinces in China, and then open the CSV file to display the relationship between GDP per capita and GDP per Province in […]
-
Resample
Resampling will display the data according to the obtained date parameters and convert the data from one frequency to another, There are three main categories: 1. Up sampling: from low frequency to high frequency (e.g. from monthly to daily) 2. Down sampling: from high frequency to low frequency (e.g. from daily to monthly) 3. Sampling […]
-
Groupby operation in pandas in pandas advanced tutorial
catalogue brief introduction Split data Multiple index get_group dropna Groups attribute Index hierarchy Group traversal Aggregation operation General polymerization method You can specify multiple aggregation methods at the same time: NamedAgg Different columns specify different aggregation methods Conversion operation Filtering operation Apply operation brief introduction DF data types in pandas can perform group by operations […]
-
Implementation of dataframe detecting duplicate values in pandas
This article explains in detail how to use pandas to view the duplicate data of dataframe, judge whether it is duplicate, and how to remove duplicate data ? 1 DataFrame.duplicated(subset=None, keep=’first’) Subset: if you think that several fields are repeated, the data is repeated. Put those fields after the subset in the form of a […]
-
Detailed usage of groupby in pandas
catalogue brief introduction Split data Multiple index get_group dropna Groups attribute Index hierarchy Group traversal Aggregation operation General polymerization method Using multiple aggregation methods at the same time NamedAgg Different columns specify different aggregation methods Conversion operation Filtering operation Apply operation brief introduction DF data types in pandas can perform group by operations like database […]
-
Using pandas to read table row data to judge whether it is the same
Description: At the end of the afternoon, my colleagues from the company’s supply chain department came over and asked me if I could help him solve some things that excel needs to be done manually every week. Excel is the most commonly used office tool for data processing and should be proficient in market and […]
-
Example code for pandas implementation by line selection
catalogue 1. User defined row index 2. Select data by common index 2.1 select single line data by common index 2.2 select multiple rows of data by row index 3. Select data by location index 3.2 select multiple rows of data by location index 4. Select continuous multiple lines of data 5. Select a line […]