Teradata Package for Python Function Reference on VantageCloud Lake - concat - Teradata Package for Python - Look here for syntax, methods and examples for the functions included in the Teradata Package for Python.
Teradata® Package for Python Function Reference on VantageCloud Lake
- Deployment
- VantageCloud
- Edition
- Lake
- Product
- Teradata Package for Python
- Release Number
- 20.00.00.03
- Published
- December 2024
- ft:locale
- en-US
- ft:lastEdition
- 2024-12-19
- dita:id
- TeradataPython_FxRef_Lake_2000
- Product Category
- Teradata Vantage
- teradataml.geospatial.geodataframe.GeoDataFrame.concat = concat(self, other, join='OUTER', allow_duplicates=True, sort=False, ignore_index=False)
- DESCRIPTION:
Concatenates two teradataml GeoDataFrames along the index axis.
PARAMETERS:
other:
Required Argument.
Specifies the other teradataml DataFrame/GeoDataFrame with which the
concatenation is to be performed.
Types: teradataml GeoDataFrame or teradataml DataFrame
join:
Optional Argument.
Specifies how to handle indexes on columns axis.
Supported values are:
* 'OUTER': It instructs the function to project all columns from both
the GeoDataFrames. Columns not present in either GeoDataFrame
will have a SQL NULL value.
* 'INNER': It instructs the function to project only the columns common
to both GeoDataFrames.
Default value: 'OUTER'
Permitted values: 'INNER', 'OUTER'
Types: str
allow_duplicates:
Optional Argument.
Specifies if the result of concatenation can have duplicate rows.
Default value: True
Types: bool
sort:
Optional Argument.
Specifies a flag to sort the columns axis if it is not already aligned
when the join argument is set to 'outer'.
Default value: False
Types: bool
ignore_index:
Optional argument.
Specifies whether to ignore the index columns in resulting GeoDataFrame or not.
If True, then index columns will be ignored in the concat operation.
Default value: False
Types: bool
RETURNS:
teradataml GeoDataFrame
RAISES:
TeradataMlException
EXAMPLES:
>>> from teradataml import load_example_data, GeoDataFrame, DataFrame
>>> load_example_data("geodataframe",["sample_streets", "sample_cities"])
# Create required GeoDataFrames.
>>> df1 = GeoDataFrame('sample_streets')
>>> df1
street_name street_shape
skey
1 Coast Blvd LINESTRING (12 12,18 17)
1 Main Street LINESTRING (2 2,3 2,4 1)
>>>
>>> df2 = GeoDataFrame('sample_cities')
>>> df2
city_name city_shape
skey
1 Seaside POLYGON ((10 10,10 20,20 20,20 15,10 10))
0 Oceanville POLYGON ((1 1,1 3,6 3,6 0,1 1))
>>>
# Example 1: Concat two GeoDataFrames with default options.
>>> cdf = df1.concat(df2)
>>> cdf
street_name street_shape city_name city_shape
skey
1 None None Seaside POLYGON ((10 10,10 20,20 20,20 15,10 10))
0 None None Oceanville POLYGON ((1 1,1 3,6 3,6 0,1 1))
1 Coast Blvd LINESTRING (12 12,18 17) None None
1 Main Street LINESTRING (2 2,3 2,4 1) None None
>>>
# Example 2: Concat two GeoDataFrames with inner join.
>>> cdf = df1.concat(df2, join='inner')
>>> cdf
Empty DataFrame
Columns: []
Index: [1, 1, 1, 0]
>>>
# Example 3: Concat two GeoDataFrames with by allowing duplicates, if there are any.
# allow_duplicates = True
>>> cdf = df1.concat(df2)
>>> cdf
street_name street_shape city_name city_shape
skey
1 None None Seaside POLYGON ((10 10,10 20,20 20,20 15,10 10))
0 None None Oceanville POLYGON ((1 1,1 3,6 3,6 0,1 1))
1 Coast Blvd LINESTRING (12 12,18 17) None None
1 Main Street LINESTRING (2 2,3 2,4 1) None None
>>> cdf = cdf.concat(df2)
>>> cdf
street_name street_shape city_name city_shape
skey
1 Main Street LINESTRING (2 2,3 2,4 1) None None
1 None None Seaside POLYGON ((10 10,10 20,20 20,20 15,10 10))
1 None None Seaside POLYGON ((10 10,10 20,20 20,20 15,10 10))
1 Coast Blvd LINESTRING (12 12,18 17) None None
0 None None Oceanville POLYGON ((1 1,1 3,6 3,6 0,1 1))
0 None None Oceanville POLYGON ((1 1,1 3,6 3,6 0,1 1))
>>>
# Example 4: Concat two GeoDataFrames but do not allow duplicates, if there are any.
# allow_duplicates = False
>>> cdf = cdf.concat(df2, allow_duplicates=False)
>>> cdf
street_name street_shape city_name city_shape
skey
1 Coast Blvd LINESTRING (12 12,18 17) None None
1 Main Street LINESTRING (2 2,3 2,4 1) None None
1 None None Seaside POLYGON ((10 10,10 20,20 20,20 15,10 10))
0 None None Oceanville POLYGON ((1 1,1 3,6 3,6 0,1 1))
>>>
# Example 5: Concat two GeoDataFrames with sort set to True.
>>> cdf = df1.concat(df2, sort=True)
>>> cdf
city_name city_shape street_name street_shape
skey
1 Seaside POLYGON ((10 10,10 20,20 20,20 15,10 10)) None None
0 Oceanville POLYGON ((1 1,1 3,6 3,6 0,1 1)) None None
1 None None Coast Blvd LINESTRING (12 12,18 17)
1 None None Main Street LINESTRING (2 2,3 2,4 1)
>>>
# Example 6: Concat two GeoDataFrames with ignore_index set to True.
>>> cdf = df1.concat(df2, ignore_index=True)
>>> cdf
street_name street_shape city_name city_shape
0 None None Seaside POLYGON ((10 10,10 20,20 20,20 15,10 10))
1 None None Oceanville POLYGON ((1 1,1 3,6 3,6 0,1 1))
2 Coast Blvd LINESTRING (12 12,18 17) None None
3 Main Street LINESTRING (2 2,3 2,4 1) None None
>>>
# Example 7: Concat a GeoDataFrame with teradataml DataFrame.
>>> load_example_data("dataframe", "admissions_train")
>>> tdf = DataFrame("admissions_train")
>>> cdf = df1.concat(tdf, ignore_index=True)
>>> cdf
street_name street_shape masters gpa stats programming admitted
0 None None yes 2.65 Advanced Beginner 1
1 None None no 3.44 Novice Novice 0
2 None None no 1.87 Advanced Novice 1
3 None None no 3.83 Advanced Advanced 1
4 None None no 4.00 Advanced Novice 1
5 None None yes 3.46 Advanced Beginner 0
6 None None no 3.13 Advanced Advanced 1
7 None None no 3.82 Advanced Advanced 1
8 None None yes 3.85 Advanced Beginner 0
9 None None yes 3.57 Advanced Advanced 1
>>>