> For the complete documentation index, see [llms.txt](https://george-jen.gitbook.io/data-science-and-apache-spark/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://george-jen.gitbook.io/data-science-and-apache-spark/data-structure.md).

# Python Class

### Data structure

Besides list, tuple, string, dictionary, set are data structure, you can define class that has attributes

For example

```
class car(object):
    wheel_number=4
    seal_row_number=2
    
    def __init__(self,brand):
        self.brand=brand
```

wheel\_number, seal\_row\_number are class attributes, class attributes can be of any data type, include

list, tuple, string, dictionary and set

You notice class can also have methods, \_\_**init\_\_()** is called constructor method, it runs when instantiating a class, for example

small\_car=car("toyota")

small\_car.brand

'toyota’

small\_car.seal\_row\_number

![](/files/-M1fdAlWiwkc7yE7f3gh)

2
