Showing posts with label Python. Show all posts
Showing posts with label Python. Show all posts

Try Data Engineering in Python with Snowpark in Just 10 Minutes [new feature]

Try Data Engineering in Python with Snowpark


Getting Started with Snowpark in Snowflake Python Worksheets

By completing this guide, you will be able to try Snowpark for Python all from within the Snowflake UI. At the end, you’ll have a better understanding of how to perform core data engineering tasks using Snowpark in Snowflake Python Worksheet.
What is Snowpark
It allows developers to query data and write data applications inside Snowflake with languages other than SQL using a set of APIs and DataFrame-style programming constructs in Python, Java, and Scala. These applications run on and take advantage of the same distributed computation on Snowflake's elastic engine as your SQL workloads. Learn more about Snowpark.
What is Python Worksheet
Python worksheets are a new type of worksheet in Snowsight that helps you get started with Snowpark faster. Users can develop data pipelines, ML models and applications directly inside Snowflake, no additional IDE (development UI) to spin up, set up or maintain for Python. These worksheets can be converted into procedures to schedule your Snowpark applications.
What you will learn
- Load data from Snowflake tables into Snowpark DataFrames

- Perform Exploratory Data Analysis on Snowpark DataFrames

- Pivot and Join data from multiple tables using Snowpark DataFrames

- Save transformed data into Snowflake table
What you will build
A prepared dataset that can be used in downstream analysis and applications. For example, training a machine learning model.


Setup Lab

You may start with a 30-day trial account ($400 credit).






















Python中的变量类型转换

Python中的变量类型转换

⏩类型转换四个函数 int() float() str() bool()

👉int() 可以用来将其他的对象转换为整型

规则:

#   布尔值:True -> 1   False -> 0
#   浮点数:直接取整,省略小数点后的内容
#   字符串:合法的整数字符串,直接转换为对应的数字
#           如果不是一个合法的整数字符串,则报错 ValueError: invalid literal for int() with base 10: '11.5'
             如果是其它base,需要多加一个base参数来转换,例如:
                    print(int('0x123',16))
                    print(int('0o123',8))


 

#   对于其他不可转换为整型的对象,直接抛出异常 ValueError

👉float() 和 int()基本一致,不同的是它会将对象转换为浮点数

👉str() 可以将对象转换为字符串

#  True -> 'True'
#  False -> 'False'
#  123 -> '123' 

👉 bool() 可以将对象转换为布尔值,任何对象都可以转换为布尔值

#   规则:对于所有表示空性的对象都会转换为False,其余的转换为True
#       哪些表示的空性:0 、 None 、 '' 。。。

👉用type进行类型检查

print(type(a))

Naming Conventions in Python (代码规范,命名规则)

Naming Convention in Python (代码规范,命名规则)

General rules: 


CamelCase/camelCase (mixed case) 


 CamelCase


camelCase

Ref: https://en.wikipedia.org/wiki/Camel_case

Camel case (sometimes stylized as camelCase or CamelCase, also known as camel caps or more formally as medial capitals) is the practice of writing phrases without spaces or punctuation and with capitalized words. The format indicates the first word starting with either case, then the following words having an initial uppercase letter. Common examples include "YouTube", "iPhone" and "eBay". Camel case is often used as a naming convention in computer programming. It is also sometimes used in online usernames such as "JohnSmith", and to make multi-word domain names more legible, for example in promoting "EasyWidgetCompany.com".

The more specific terms Pascal case and upper camel case refer to a joined phrase where the first letter of each word is capitalized, including the initial letter of the first word. Similarly, lower camel case (also known as dromedary case) requires an initial lowercase letter. Some people and organizations, notably Microsoft, use the term camel case only for lower camel case, designating Pascal case for the upper camel case.

Snake case

snake_case


Snake case (stylized as snake_case) refers to the style of writing in which each space is replaced with an underscore (_) character, and the first letter of each word is written in lowercase. It is a commonly used naming convention in computing, for example for variable and subroutine names, and for filenames. One study has found that readers can recognize snake case values more quickly than camel case.

Featured Posts

SnowPro Badges and Certificates

SnowPro Badges and Certificates Online Verification https://achieve.snowflake.com/profile/richardhou888/wallet

Popular Posts Recommended