Struktur Data di Python

Data structures are a way of organizing and storing data so that they can be accessed and worked with efficiently. They define the relationship between the data, and the operations that can be performed on the data. [1]

source : adapted from

1. Data Frame

##### Groupby
##### Join
##### Union
pd.concat([df1,df2],axis=0,ignore_index=True) # union by rows
pd.concat([df1,df2],axis=1,ignore_index=True) # union by columns
##### IN, NOT IN
df[df.relid.isin(userid)] # IN userid list
df[~df.relid.isin(userid)] # NOT IN userid list

is two-dimensional size-mutable, potentially heterogeneous tabular data structure with labeled axes (rows and columns). [3]

2. List

'org' in ['com','id','org']
[1,2,3] + [4,5]
[k for k in temp if k not in ['a','b']]
["hello" for _ in range(len(adj))]

is a collection which is ordered and changeable. Allows duplicate members.
x = [“a”, “b”, “c”]. [3]

3. Dictionary (Dict)

is a collection which is unordered, changeable and indexed. No duplicate members.
x = { “brand”: “Fer”, “loc”: “Malang”, “year”: 2009 }. [3]

4. Set

is a collection which is unordered and unindexed. No duplicate members.
x = {“a”, “b”, “c”}. [3]

5. Tuple

is a collection which is ordered and unchangeable. Allows duplicate members.
x = (“a”, “b”, “c”). [3]

6. Array

is a sequential arrangement of data elements paired with the index of the data element. [3]



Data Scientist Jagoan Hosting. Visit my website at

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store