Back

Sanskar

Keen Learner and Exp... • 2d

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... • 14h

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... • 26d

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

Shubham

Fearless • 26d

🚀 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

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... • 3d

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

Sagar gupta

Full-time Freelancer... • 1y

Most Javascript Questions Asked in Interview | PART 2 1. What is difference between a for loop and for Each loop Ans: A for loop is traditional loop that uses a counter variable to iterate over an array. ForEach loop is a method that iterate over a

See More
Reply
3
10
Image Description
Image Description

Chintan Udani

I'm a pro medialist • 2m

Non-programmers using AI to create apps is "vibe coding". The generated apps appear to work, but they may not function as intended in all cases. Furthermore, apps shouldn't only function properly but also be secure: you shouldn't make your users' da

See More
11 Replies
20
2

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