Back

Sanskar

Keen Learner and Exp... • 23d

Day 6 of learning Data Science as a beginner. Topic: creating NumPy arrays NumPy arrays can be created using various ways one of them is using python list and converting it into a numpy array however this is a long way here you first create a python list and then use np(short form of numpy).array to convert that list into a numpy array this increases the unnecessary code lines and is also not very efficient. Some other way of creating a numpy array directly are: 1. np.zeros(): this will create an array full of zeros 2. np.ones(): this will create an array full of ones 3. np.full(): here you have to input the shape of the array and what integer you want to fill it with 4. np.eye(): this will create a matrix full of ones in main diagonal (aka identity matrix) 5. np.arange(): this works just like python's range function in for loop 6. np.linspace(): this creates an evenly spaced array you can also find the shape, size, datatype and dimension of arrays using .shape .size .dtype and .ndim functions of numpy. You can even reshape the array using .reshape function and can also change its datatype using .astype function. Numpy also offers a .flatten function which converts a 2D array to 1D. In short NumPy offers some really flexible options to create arrays effectively. Also here's my code and its result.

Reply
10

More like this

Recommendations from Medial

Sanskar

Keen Learner and Exp... • 21d

Day 7 of learning Data Science as a beginner. Topic: Indexing and Slicing NumPy arrays Since a past few days I have been learning about NumPy arrays I have learned about creating arrays from list and using other numpy functions today I learned abou

See More
Reply
1
Image Description
Image Description

Sanskar

Keen Learner and Exp... • 1m

Day 12 of learning AI/ML as a beginner. Topic: TF-IDF practical. Yesterday I shared my theory notes and today I have done the practical of TF-IDF. For the practical I reused my spam classifier code and for TF-IDF I first imported it from the sklear

See More
2 Replies
1
13
1

Prince Singh Chouhan

Front-end Developer • 1y

#Array in #javascript: Array in Javascript enables storing a collection of multiple items under a single variable name, and has members for performing common array operations. Arrays aren't primitives but are instead Array #objects with the followin

See More
Reply
2

Somen Das

Senior developer | b... • 1y

Array.reduce() is Goated the Swiss army knife Summing Numbers: Using reduce() to calculate the sum of numbers in an array. Flattening Arrays: Flattening a nested array into a single array. Grouping Objects: Grouping objects based on a speci

See More
Reply
5

Sanskar

Keen Learner and Exp... • 12d

Day 11 of learning Data science as a beginner Topic: creating data structure In my previous post I discussed about the difference between panda's series and data frames we typically use data frames more often as compared to series There are a lot

See More
Reply
2

Shubham

Fearless • 1m

🚀 Day 4/21 – My JavaScript Learning Journey Today’s focus: Arrays in JavaScript 📦 An Array is a special object in JS used to store multiple values in a single variable. 🔹 Creating Arrays let fruits = ["Apple", "Banana", "Mango"]; 🔹 Common Me

See More
Reply
3

Sanskar

Keen Learner and Exp... • 15d

Day 9 of learning Data Science as a beginner. Topic: Data Types & Broadcasting NumPy offers various data types for a variety of things for example if you want to store numerical data it will be stored in int32 or int64 (depending on your system's a

See More
Reply
3

Prince Yadav

Co -founder at Trade... • 1y

Today I Learnt stack using Linked list and Array in C++. Here is a Code of Stack Using Linked List.

Reply
5

Sanskar

Keen Learner and Exp... • 24d

Day 5 of learning Data Science as a beginner Topic: Using NumPy in Data Science Python despite having much advantages (like being beginner friendly, easy to read) is also famous for its one limitation i.e. it is slow. We don't really feel much abou

See More
Reply
9

Sidharth Bidikar

Keep Moving • 1y

What is the most efficient way to combine text from multiple cells into one cell without using the CONCATENATE function? A) Using the TEXTJOIN function B) Using the LEFT function C) Using the SUBSTITUTE function #excel #msexcel #dataanalyst #dataan

See More
Reply
1
5

Download the medial app to read full posts, comements and news.