ID name sexa lm 0 lxh 0b- ly 1 Xiao 1 using full outer connection age CP ID name sexa lm 0 lxh 0b- ly 1 Xiao 1c 4 yry 2 hua NaNd all 3 be NaNe nan nan nan nan 2There is another way to connect: concatThe Concat method is equivalent to the full connection in the database (UNION all), you can specify whether to connect by an axis, or you can specify joins in the same way (Outer,inner only these two
1 concat
The Concat function is a method underneath the pandas that allows for a simple fusion of data based on different axes.
Pd.concat (Objs, axis=0, join= ' outer ', Join_axes=none, Ignore_index=false, Keys=none, Levels=none, Names=None,
Verify_integrity=false)1 2 1 2 1 2
Parameter descriptionObjs:series,dataframe or a sequence of panel compositions
At the time of data processing, especially in the big data contest, often encounter a problem is that multiple forms of merging problems, such as a form has user_id and age two fields, another form has user_id and sex two fields, to merge these two tables into only user_id, Age, sex three fields of the table what to do, the ordinary stitching is not possible, because user_id each row is not the corresponding, like the building blocks of horizontal stitching is certainly not. There is a merge fun
Information_schemaThis is the initial writing, and the performance is as followsThe last way to deal with it: The statement is written out, to achieve our desired effect; if there are other tables in this library in the future, they will be added to the CONCAT output statement.The above is not the best effectWe'd better export the statement to the specified fileThe first execution will be error;This is handled as follows: New statements under/ETC/MY.
An example of CONCAT (string concatenation function) and GROUP_CONCAT
CONCAT
Sometimes, we need to link the data obtained from different columns. Each database provides methods to achieve this purpose:MySQL: CONCAT ()
Oracle: CONCAT (), |
SQL Server: +
The
There is now a list of the top 2000 global listed companies in Forbes 2016, but the original data is not standardized and needs to be processed before it can be used further.
In this paper, we introduce the data pandas by using the example operation.
As usual, let me start by saying my operating environment, as follows:
Windows 7, 64-bit
Python 3.5
Pandas
This article brings the content is about Python pandas in-depth understanding (code example), there is a certain reference value, the need for friends can refer to, I hope to help you.
First, screening
First, create a 6X4 matrix data.
Dates = Pd.date_range (' 20180830 ', periods=6) df = PD. DataFrame (Np.arange) reshape ((6,4)), index=dates, columns=[' A ', ' B ', ' C ', ' D ']) print (DF)
Print:
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.