寒咳嗽吃什么药止咳效果好| 胆囊炎要注意些什么| 什么叫私生饭| 白居易有什么之称| 胃疼什么原因| 肢解是什么意思| 抽动症是什么原因造成的| 子宫脱落有什么症状| 喉咙痛有黄痰吃什么药| 四季春茶属于什么茶| 吃什么对牙齿好| 肛门里面痒是什么原因| 胃疼吃什么药| 尿失禁吃什么药最好| 8月26是什么星座| 一笑了之是什么意思| 金牛男和什么星座女最配| 甘草长什么样子图片| NF什么意思| 下巴长痘是什么原因| 标准工资指什么| 名垂千古是什么意思| 小孩老是打嗝是什么原因| 为什么会耳鸣| 女生有美人尖代表什么| 欢愉是什么意思| 抖s是什么意思| 防晒衣什么面料好| 再接再厉后面接什么好| 吃什么水果减肥最快减肚子| 但爱鲈鱼美的但是什么意思| 小孩腰疼是什么原因| 什么叫多动症| 盗汗吃什么药| 摇粒绒是什么面料| 潜伏是什么意思| 什么护肤产品补水最好| 墨镜镜片什么材质好| 经常吐是什么原因| 眼睛肿胀是什么原因| 地动山摇是什么生肖| ost是什么| 女人湿气太重喝什么茶| 四肢抽搐口吐白沫是什么病| 恶心想吐吃什么药| hedgren是什么品牌| 玉竹有什么功效| 衣原体感染是什么病| 耳垂后面有痣代表什么| 为什么会无缘无故长痣| 寄生虫吃什么药可以杀死| 道场是什么意思| 风油精有什么作用| 内含是什么意思| 有容乃大是什么意思| 腰肌劳损什么症状| 火腿是什么肉| 吃什么补血补气效果好| 旋转跳跃我闭着眼是什么歌| 红皮鸡蛋和白皮鸡蛋有什么区别| 幼字五行属什么| 什么是筋膜| 放屁多吃什么药好| 开封有什么大学| vsc是什么意思| vocabulary是什么意思| 额窦炎吃什么药管用| 肚子胀气吃什么通气| 虎皮膏药有什么功效| 挫伤是什么意思| 菜瓜是什么瓜| 星月菩提是什么材质| 什么是感恩| 什么的长城| 高血压什么症状表现| 丝袜是什么材质| 行政管理是做什么的| 及时是什么意思| 三点水念什么| 膝盖疼应该挂什么科| 什么牌子的冰箱最好| 梦见父亲死了是什么意思| 什么人入什么| 右肺下叶纤维灶是什么意思| 7月12日什么星座| 2020属什么生肖| 尪痹片主治什么| eos是什么| 脚后跟疼挂什么科| y谷氨酰基转移酶高是什么原因| 丑时属什么| 心有余悸是什么意思| 八哥是什么鸟| 少许纤维灶是什么意思| 屁特别臭是什么原因| 甘油三酯高吃什么好| 最大的动物是什么| 脂肪肝适合吃什么食物| 今年77岁属什么生肖| 1963年属什么| 身体肿是什么原因引起的| 红枣什么时候吃最好| 开车压到蛇有什么说法| 糖宝是什么意思| 没出息什么意思| 小气道病变是什么意思| 为什么尿是黄的| 枯木逢春什么意思| 药学是什么| 血压低压高是什么原因造成的| 漏尿是什么原因造成的| 油墨用什么可以洗掉| 张学良为什么不回大陆| 澳大利亚有什么动物| 口臭是什么原因造成的| 乌龟用什么呼吸| 青少年腰疼是什么原因引起的| 小号避孕套是什么尺寸| 种植什么最赚钱农村| 口腔溃疡看什么科| 大便稀溏是什么意思| 你要什么| 377是什么| 霸天虎和威震天是什么关系| 一个木一个舌读什么| 脚痒用什么药好| bape是什么品牌| 眼睛淤青用什么方法能快点消除| 鸡枞是什么| 糖尿病早期什么症状| 阴晴不定是什么意思| 甲减什么症状| 为什么女娲是一条蛇| 拉肚子吃什么药| 饱不洗头饿不洗澡是为什么| 昧是什么意思| 梦见家被偷了什么预兆| 血压低吃什么能补上来| 糖尿病可以吃什么零食| cc是什么牌子| 抗hp治疗是什么意思| 酒后第二天吃什么| 马头岩肉桂是什么茶| 幽门螺杆菌感染有什么症状| 寒是什么意思| 什么是断桥铝| 空是什么生肖| 低头头晕是什么原因| 阴茎长水泡是什么原因| 什么叫五行| 10.1是什么星座| 文定之喜是什么意思| 拔罐为什么会起水泡| 轻医美是什么| 死海为什么叫死海| 同一首歌为什么停播了| 蓝黑色是什么颜色| 猛犸象什么时候灭绝的| mmhg是什么意思| 9月17号是什么星座的| 无住生心是什么意思| 金卡有什么好处和坏处| 鸽子吃什么食物| 放屁特别臭是什么原因| 胡子发黄是什么原因| 经常梳头有什么好处| 尿毒症有些什么症状| 恳谈会是什么意思| 肉便器是什么东西| 什么叫基因检测| 蝎子吃什么| 土地出让金什么意思| 慈禧为什么要毒死光绪| 尿白细胞定量高是什么意思| 黄仙是什么仙| 启明星是什么意思| 什么叫消融术治疗| 痔疮有什么特征| 急性结膜炎用什么眼药水| 一本线是什么意思| 九加虎念什么| 焕字五行属什么| 灵芝与什么相克| 甲沟炎去医院挂什么科| 生意兴隆是什么意思| 鹿加几念什么| b1是什么意思| 框框是什么意思| 男人气虚吃什么补得快| 胳膊麻是什么原因| 眼角流泪是什么原因| 梦见自己得了重病预示什么| 喝啤酒不能吃什么| 包皮什么年龄割最好| 海誓山盟是什么意思| 个人solo什么意思| 叶酸什么时候吃最好| 子宫内膜手术后需要注意什么| 2014年五行属什么| 什么是小三| 情花是什么花| 孙悟空头上戴的是什么| 脱臼是什么感觉| 什么药退烧快| 住院医师是什么职称| 瘫痪是什么意思| 做造影对身体有什么伤害| 黑下打信是什么任务| 广州有什么山| 仓鼠是什么动物| 利字五行属什么| 中暑了喝什么| 跳蚤喜欢咬什么样的人| 胸部ct可以检查出什么| 外痔用什么药| 尿隐血3十是什么病| 外寒内热感冒吃什么药| 肝功能查什么| 竹子可以做什么| 7点到9点是什么时辰| 心脏早搏吃什么药效果好| 熬夜伤什么器官| 子宫内膜息肉吃什么药| 胰腺炎是什么症状| 低血糖什么症状| 檀香是什么味道| 大便里急后重什么意思| 身上痒是什么情况| 冒犯是什么意思| 胸部胀痛什么原因| 小虾米吃什么| 丝瓜有什么营养| 丝状疣是什么原因长出来的| 金乐什么字| 腰扭伤挂什么科| 睾丸突然疼痛什么原因| 日加西念什么| tim是什么| 什么瓜不能吃脑筋急转弯| 补气养血吃什么中成药| 无药可救是什么意思| 产后为什么脸部松弛| 荷叶和山楂一起泡水有什么功效| 身份证最后四位数代表什么| 旭日是什么意思| hda是什么| 断掌有什么说法| 孕妇忌吃什么| 地三鲜是什么菜| 不孕不育查什么项目| 青春不散场什么意思| 胸痛什么原因| 肉桂和桂皮有什么区别| 基础代谢率是什么意思| 什么是贡菜| 一个口四个又念什么| 脸肿是什么原因| 紫砂壶泡什么茶最好| 丝瓜烧什么好吃| tb是什么意思啊| 镇关西是什么意思| suv什么意思| 猪胰是什么东西| 纸片人什么意思| 百度
 

[视频]国家食品药品监管总局:多措并举 打击治理...

百度 树立文化发展“新思想”新的伟大的实践必然产生新的伟大的理论,新的伟大的理论又必将指导新的伟大的实践,新时代中国特色社会主义文化创新需要新的指导思想。

DuckDB combines the simplicity and ease of use of SQLite with the analytical performance of specialized columnar databases. Learn more with Python examples.



Why is DuckDB Getting Popular?
Image by Author

 

What is DuckDB?

 

DuckDB is a free, open-source, embedded database management system designed for data analytics and online analytical processing. This means several things:

  1. It's free and open-source software, so anyone can use and modify the code.
  2. It's embedded, meaning the DBMS (database management system) runs in the same process as the application that uses it. This makes it fast and simple to use.
  3. It's optimized for data analytics and OLAP (online analytical processing), not just transactional data like typical databases. This means the data is organized by columns instead of rows to optimize aggregation and analysis.
  4. It supports standard SQL so you can run queries, aggregations, joins, and other SQL functions on the data.
  5. It runs in-process, within the application itself rather than as a separate process. This eliminates the overhead of communicating between processes.
  6. Like SQLite, it's a simple, file-based database so there's no separate server installation required. You just include the library in your application.

In summary, DuckDB provides an easy-to-use, embedded analytic database for applications that need fast and simple data analysis capabilities. It fills a niche for analytical processing where a full database server would be overkill.

 

Why is DuckDB Getting Popular?

 

There are many reasons companies are now building products on top of DuckDB. The database is designed for fast analytical queries which means it's optimized for aggregations, joins, and complex queries on large datasets - the types of queries often used in analytics and reporting. Moreover:?

  1. It's simple to install, deploy, and use. There is no server to configure - DuckDB runs embedded within your application. This makes it easy to integrate into different programming languages and environments.
  2. Despite its simplicity, DuckDB has a rich feature set. It supports the full SQL standard, transactions, secondary indexes, and integrates well with popular data analysis programming languages like Python and R.
  3. DuckDB is free for anyone to use and modify, which lowers the bar for developers and data analysts to adopt it.
  4. DuckDB is well-tested and stable. It has an extensive test suite and is continuously integrated and tested on a variety of platforms to ensure stability.
  5. DuckDB offers comparable performance to specialized OLAP databases while being easier to deploy. This makes it suitable for both analytical queries on small to medium datasets as well as large enterprise datasets.

In short, DuckDB combines the simplicity and ease of use of SQLite with the analytical performance of specialized columnar databases. All of these factors - performance, simplicity, features, and open source license - contribute to DuckDB's growing popularity among developers and data analysts.

 

DuckDB Python Example

 

Let’s test out a few features of DuckDB using the Python API.?

You can instal DuckDB using Pypi:

pip install duckdb

 

For other programming language, head to the DuckDB’s installation guide.?

 

Why is DuckDB Getting Popular?

 

In this example, we will be using Data Science Salaries 2023 CSV dataset from Kaggle and try to test DuckDB’s various functionalities.?

 

Relation API

 

You can load a CSV file just like pandas into a relation. DuckDB provides a relational API that allows users to link query operations together. The queries are lazily evaluated, which enables DuckDB to optimize their execution.

We have loaded the data science salary dataset and displayed the alias.?

import duckdb
rel = duckdb.read_csv('ds_salaries.csv')
rel.alias

 

'ds_salaries.csv'

 

To display the column names we will use .columns similar to pandas.?

rel.columns

 

['work_year',
 'experience_level',
 'employment_type',
 'job_title',
 'salary',
 'salary_currency',
 'salary_in_usd',
 'employee_residence',
 'remote_ratio',
 'company_location',
 'company_size']

 

You can apply multiple functions to the relation to get specific results. In our case, we have filtered out “work_year”, displayed only three columns, and ordered and limited them to display the bottom five job titles based on the salaries.?

Learn more about Relational API by following the guide.?

rel.filter("work_year > 2021").project(
    "work_year,job_title,salary_in_usd"
).order("salary_in_usd").limit(5)

 

┌───────────┬─────────────────┬───────────────┐
│ work_year │    job_title    │ salary_in_usd │
│   int64   │     varchar     │     int64     │
├───────────┼─────────────────┼───────────────┤
│      2022 │ NLP Engineer    │          5132 │
│      2022 │ Data Analyst    │          5723 │
│      2022 │ BI Data Analyst │          6270 │
│      2022 │ AI Developer    │          6304 │
│      2022 │ Data Analyst    │          6359 │
└───────────┴─────────────────┴───────────────┘

 

You can also use Relational API to join two datasets. In our case, we are joining the same dataset by changing the alias name on a “job_title”.?

rel2 = duckdb.read_csv('ds_salaries.csv')
rel.set_alias('a').join(rel.set_alias('b'), 'job_title').limit(5)

 

┌───────────┬──────────────────┬─────────────────┬───┬──────────────┬──────────────────┬──────────────┐
│ work_year │ experience_level │ employment_type │ ... │ remote_ratio │ company_location │ company_size │
│   int64   │     varchar      │     varchar     │   │    int64     │     varchar      │   varchar    │
├───────────┼──────────────────┼─────────────────┼───┼──────────────┼──────────────────┼──────────────┤
│      2023 │ SE               │ FT              │ ... │          100 │ US               │ L            │
│      2023 │ MI               │ CT              │ ... │          100 │ US               │ S            │
│      2023 │ MI               │ CT              │ ... │          100 │ US               │ S            │
│      2023 │ SE               │ FT              │ ... │          100 │ US               │ S            │
│      2023 │ SE               │ FT              │ ... │          100 │ US               │ S            │
├───────────┴──────────────────┴─────────────────┴───┴──────────────┴──────────────────┴──────────────┤
│ 5 rows                                                                         21 columns (6 shown) │
└─────────────────────────────────────────────────────────────────────────────────────────────────────┘

 

Direct SQL method

 

There are direct methods too. You just have to write SQL query to perform analysis on the dataset. Instead of the table name, you will write the location and name of the CSV file.?

duckdb.sql('SELECT * FROM "ds_salaries.csv" LIMIT 5')

 

┌───────────┬──────────────────┬─────────────────┬───┬──────────────┬──────────────────┬──────────────┐
│ work_year │ experience_level │ employment_type │ ... │ remote_ratio │ company_location │ company_size │
│   int64   │     varchar      │     varchar     │   │    int64     │     varchar      │   varchar    │
├───────────┼──────────────────┼─────────────────┼───┼──────────────┼──────────────────┼──────────────┤
│      2023 │ SE               │ FT              │ ... │          100 │ ES               │ L            │
│      2023 │ MI               │ CT              │ ... │          100 │ US               │ S            │
│      2023 │ MI               │ CT              │ ... │          100 │ US               │ S            │
│      2023 │ SE               │ FT              │ ... │          100 │ CA               │ M            │
│      2023 │ SE               │ FT              │ ... │          100 │ CA               │ M            │
├───────────┴──────────────────┴─────────────────┴───┴──────────────┴──────────────────┴──────────────┤
│ 5 rows                                                                         11 columns (6 shown) │
└─────────────────────────────────────────────────────────────────────────────────────────────────────┘

 

Persistent Storage

 

By default, DuckDB operates on an in-memory database. This means that any tables created are stored in memory and not persisted to disk. However, by using the .connect() method, a connection can be made to a persistent database file on disk. Any data written to that database connection will then be saved to the disk file and reloaded when reconnecting to the same file.

  1. We will create a database by using .connect() method.
  2. Run an SQL query to create a table.
  3. Use Query to add two records.
  4. Display the newly created test table.?
import duckdb

con = duckdb.connect('kdn.db')

con.sql("CREATE TABLE test_table (i INTEGER, j STRING)")
con.sql("INSERT INTO test_table VALUES (1, 'one'),(9,'nine')")
con.table('test_table').show()

 

┌───────┬─────────┐
│   i   │    j    │
│ int32 │ varchar │
├───────┼─────────┤
│     1 │ one     │
│     9 │ nine    │
└───────┴─────────┘

 

We can also create the new table using a data science salary CSV file.?

con.sql('CREATE TABLE ds_salaries AS SELECT * FROM "ds_salaries.csv";')
con.table('ds_salaries').limit(5).show()

 

┌───────────┬──────────────────┬─────────────────┬───┬──────────────┬──────────────────┬──────────────┐
│ work_year │ experience_level │ employment_type │ ... │ remote_ratio │ company_location │ company_size │
│   int64   │     varchar      │     varchar     │   │    int64     │     varchar      │   varchar    │
├───────────┼──────────────────┼─────────────────┼───┼──────────────┼──────────────────┼──────────────┤
│      2023 │ SE               │ FT              │ ... │          100 │ ES               │ L            │
│      2023 │ MI               │ CT              │ ... │          100 │ US               │ S            │
│      2023 │ MI               │ CT              │ ... │          100 │ US               │ S            │
│      2023 │ SE               │ FT              │ ... │          100 │ CA               │ M            │
│      2023 │ SE               │ FT              │ ... │          100 │ CA               │ M            │
├───────────┴──────────────────┴─────────────────┴───┴──────────────┴──────────────────┴──────────────┤
│ 5 rows                                                                         11 columns (6 shown) │
└─────────────────────────────────────────────────────────────────────────────────────────────────────┘

 

After performing all the tasks, you must close the connection to the database.?

con.close()

 

Conclusion

 

Why do I like DuckDB? It is fast and simple to learn and manage. I believe simplicity is the main reason DuckDB has become widely used in the data science community. DuckDB provides an intuitive SQL interface that is easy for data analysts and scientists to pick up. Installation is straightforward, and the database files are light and manageable. All of these make DuckDB a joy to use.

Check out my previous Deepnote article on Data Science with DuckDB for an in-depth analysis of features and use cases.

With robust tools for data loading, managing, and analysis, DuckDB offers an attractive option compared to other database solutions for data science. I believe DuckDB will continue gaining users in the coming years as more data professionals discover its user-friendly nature.
 
 
Abid Ali Awan (@1abidaliawan) is a certified data scientist professional who loves building machine learning models. Currently, he is focusing on content creation and writing technical blogs on machine learning and data science technologies. Abid holds a Master's degree in Technology Management and a bachelor's degree in Telecommunication Engineering. His vision is to build an AI product using a graph neural network for students struggling with mental illness.
 



meq是什么单位 9.3号是什么星座 八十岁叫什么之年 为什么不建议吃茵栀黄 为什么养鱼养单不养双
公检法是什么 上海最高楼叫什么大厦有多少米高 口腔溃疡什么症状 情感障碍是什么意思 什么运动能长高
肺部有阴影一般是什么病 红细胞是什么意思 肠胃不好吃什么菜比较好 更年期什么时候 rna是什么意思
什么是囊肿 转氨酶高说明什么 灰菜有什么功效与作用 ca19-9偏高是什么意思 婚检是什么意思
叫爸爸是什么意思hcv9jop0ns1r.cn 怀孕梦见蛇是什么意思hcv8jop5ns3r.cn 检察院是干什么的gangsutong.com 腊月初六是什么星座hcv9jop8ns1r.cn 第一次怀孕有什么反应bfb118.com
推杯换盏什么意思hcv9jop3ns5r.cn 子宫癌筛查做什么检查hcv9jop7ns2r.cn 消化不良的症状吃什么药hcv8jop8ns9r.cn 宝宝蛋白质过敏喝什么奶粉hcv8jop9ns4r.cn 骨折喝什么汤恢复得快hcv8jop5ns1r.cn
为什么来完月经下面痒hcv9jop1ns6r.cn 岁月如歌是什么意思hcv8jop0ns1r.cn 梦见芹菜是什么意思hcv7jop6ns1r.cn 控诉是什么意思hcv8jop8ns7r.cn 胃饱胀是什么原因hcv8jop5ns1r.cn
嗜酸性粒细胞偏低是什么原因hcv8jop7ns0r.cn 碳素笔是什么笔hcv7jop6ns8r.cn 重字五行属什么hcv8jop0ns7r.cn 部队班长是什么军衔hcv7jop9ns1r.cn 七月属什么生肖hcv7jop9ns3r.cn
百度