Bro Code
JavaScript constructors ๐ท
updated
In this video we will create a basic pie chart using Matplotlib.
In this video we will create a simple bar chart using matplotlib.
In this video, I will show you how to create and customize grid lines with Matplotlib.
In this video I will demonstrate how to create titles and labels in Matplotlib.
This video will give you an introduction to customizing plots with Matplotlib.
In the next video, we will cover labels.
Matplotlib is a Python library used for data visualization. It provides a MATLAB-like interface for quick plotting. After finishing this series, I would recommend learning linear algebra, Scikit-learn, or more advanced Matplotlib topics.
This video serves as an introduction to the Pandas Python library. Weโll cover the basics of Pandas so you can start working with it on your own. After finishing this video, I recommend learning either Matplotlib, linear algebra, or more advanced Pandas topics.
00:00:00 Intro to Pandas ๐ผ
00:02:18 Series 1๏ธโฃ
00:13:09 DataFrames ๐ข
00:22:14 Importing ๐ฅ
00:27:15 Selection ๐ฏ
00:36:32 Filtering ๐
00:43:06 Aggregation โ
00:50:57 Data cleaning ๐งน
Copyright Disclaimer:
This video is the intellectual property of Bro Code. All rights reserved. No part of this video may be reproduced, distributed, or transmitted in any form or by any means, including but not limited to recording, uploading, or other electronic or mechanical methods, without my written permission, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law.
Data cleaning is the process of fixing or removing: incomplete, incorrect, or irrelevant data. ~75% of work done with Pandas is data cleaning.
Aggregation in pandas is when you take many values and summarize them into a single value
Filtering is when you keep only select rows of a DataFrame that meet a certain condition.
Selection in Pandas means pulling out specific data from a Series or DataFrame.
import pandas as pd
df = pd.read_csv("data.csv", index_col="Name")
pokemon = input("Enter a Pokemon name: ")
try:
print(df.loc[pokemon])
except KeyError:
print(f"{pokemon} not found")
*You can copy and paste this data to a .csv file for convenience:*
No,Name,Type1,Type2,Height,Weight,Legendary
1,Bulbasaur,Grass,Poison,0.7,6.9,0
2,Ivysaur,Grass,Poison,1,13,0
3,Venusaur,Grass,Poison,2,100,0
4,Charmander,Fire,,0.6,8.5,0
5,Charmeleon,Fire,,1.1,19,0
6,Charizard,Fire,Flying,1.7,90.5,0
7,Squirtle,Water,,0.5,9,0
8,Wartortle,Water,,1,22.5,0
9,Blastoise,Water,,1.6,85.5,0
10,Caterpie,Bug,,0.3,2.9,0
11,Metapod,Bug,,0.7,9.9,0
12,Butterfree,Bug,Flying,1.1,32,0
13,Weedle,Bug,Poison,0.3,3.2,0
14,Kakuna,Bug,Poison,0.6,10,0
15,Beedrill,Bug,Poison,1,29.5,0
16,Pidgey,Normal,Flying,0.3,1.8,0
17,Pidgeotto,Normal,Flying,1.1,30,0
18,Pidgeot,Normal,Flying,1.5,39.5,0
19,Rattata,Normal,,0.3,3.5,0
20,Raticate,Normal,,0.7,18.5,0
21,Spearow,Normal,Flying,0.3,2,0
22,Fearow,Normal,Flying,1.2,38,0
23,Ekans,Poison,,2,6.9,0
24,Arbok,Poison,,3.5,65,0
25,Pikachu,Electric,,0.4,6,0
26,Raichu,Electric,,0.8,30,0
27,Sandshrew,Ground,,0.6,12,0
28,Sandslash,Ground,,1,29.5,0
29,Nidoranโ,Poison,,0.4,7,0
30,Nidorina,Poison,,0.8,20,0
31,Nidoqueen,Poison,Ground,1.3,60,0
32,Nidoranโ,Poison,,0.5,9,0
33,Nidorino,Poison,,0.9,19.5,0
34,Nidoking,Poison,Ground,1.4,62,0
35,Clefairy,Fairy,,0.6,7.5,0
36,Clefable,Fairy,,1.3,40,0
37,Vulpix,Fire,,0.6,9.9,0
38,Ninetales,Fire,,1.1,19.9,0
39,Jigglypuff,Normal,Fairy,0.5,5.5,0
40,Wigglytuff,Normal,Fairy,1,12,0
41,Zubat,Poison,Flying,0.8,7.5,0
42,Golbat,Poison,Flying,1.6,55,0
43,Oddish,Grass,Poison,0.5,5.4,0
44,Gloom,Grass,Poison,0.8,8.6,0
45,Vileplume,Grass,Poison,1.2,18.6,0
46,Paras,Bug,Grass,0.3,5.4,0
47,Parasect,Bug,Grass,1,29.5,0
48,Venonat,Bug,Poison,1,30,0
49,Venomoth,Bug,Poison,1.5,12.5,0
50,Diglett,Ground,,0.2,0.8,0
51,Dugtrio,Ground,,0.7,33.3,0
52,Meowth,Normal,,0.4,4.2,0
53,Persian,Normal,,1,32,0
54,Psyduck,Water,,0.8,19.6,0
55,Golduck,Water,,1.7,76.6,0
56,Mankey,Fighting,,0.5,28,0
57,Primeape,Fighting,,1,32,0
58,Growlithe,Fire,,0.7,19,0
59,Arcanine,Fire,,1.9,155,0
60,Poliwag,Water,,0.6,12.4,0
61,Poliwhirl,Water,,1,20,0
62,Poliwrath,Water,Fighting,1.3,54,0
63,Abra,Psychic,,0.9,19.5,0
64,Kadabra,Psychic,,1.3,56.5,0
65,Alakazam,Psychic,,1.5,48,0
66,Machop,Fighting,,0.8,19.5,0
67,Machoke,Fighting,,1.5,70.5,0
68,Machamp,Fighting,,1.6,130,0
69,Bellsprout,Grass,Poison,0.7,4,0
70,Weepinbell,Grass,Poison,1,6.4,0
71,Victreebel,Grass,Poison,1.7,15.5,0
72,Tentacool,Water,Poison,0.9,45.5,0
73,Tentacruel,Water,Poison,1.6,55,0
74,Geodude,Rock,Ground,0.4,20,0
75,Graveler,Rock,Ground,1,105,0
76,Golem,Rock,Ground,1.4,300,0
77,Ponyta,Fire,,1,30,0
78,Rapidash,Fire,,1.7,95,0
79,Slowpoke,Water,Psychic,1.2,36,0
80,Slowbro,Water,Psychic,1.6,78.5,0
81,Magnemite,Electric,Steel,0.3,6,0
82,Magneton,Electric,Steel,1,60,0
83,Farfetch'd,Normal,Flying,0.8,15,0
84,Doduo,Normal,Flying,1.4,39.2,0
85,Dodrio,Normal,Flying,1.8,85.2,0
86,Seel,Water,,1.1,90,0
87,Dewgong,Water,Ice,1.7,120,0
88,Grimer,Poison,,0.9,30,0
89,Muk,Poison,,1.2,30,0
90,Shellder,Water,,0.3,4,0
91,Cloyster,Water,Ice,1.5,132.5,0
92,Gastly,Ghost,Poison,1.3,0.1,0
93,Haunter,Ghost,Poison,1.6,0.1,0
94,Gengar,Ghost,Poison,1.5,40.5,0
95,Onix,Rock,Ground,8.8,210,0
96,Drowzee,Psychic,,1,32.4,0
97,Hypno,Psychic,,1.6,75.6,0
98,Krabby,Water,,0.4,6.5,0
99,Kingler,Water,,1.3,60,0
100,Voltorb,Electric,,0.5,10.4,0
101,Electrode,Electric,,1.2,66.6,0
102,Exeggcute,Grass,Psychic,0.4,2.5,0
103,Exeggutor,Grass,Psychic,2,120,0
104,Cubone,Ground,,0.4,6.5,0
105,Marowak,Ground,,1,45,0
106,Hitmonlee,Fighting,,1.5,49.8,0
107,Hitmonchan,Fighting,,1.4,50.2,0
108,Lickitung,Normal,,1.2,65.5,0
109,Koffing,Poison,,0.6,1,0
110,Weezing,Poison,,1.2,9.5,0
111,Rhyhorn,Ground,Rock,1,115,0
112,Rhydon,Ground,Rock,1.9,120,0
113,Chansey,Normal,,1.1,34.6,0
114,Tangela,Grass,,1,35,0
115,Kangaskhan,Normal,,2.2,80,0
116,Horsea,Water,,0.4,8,0
117,Seadra,Water,,1.2,25,0
118,Goldeen,Water,,0.6,15,0
119,Seaking,Water,,1.3,39,0
120,Staryu,Water,,0.8,34.5,0
121,Starmie,Water,Psychic,1.1,80,0
122,Mr. Mime,Psychic,Fairy,1.3,54.5,0
123,Scyther,Bug,Flying,1.5,56,0
124,Jynx,Ice,Psychic,1.4,40.6,0
125,Electabuzz,Electric,,1.1,30,0
126,Magmar,Fire,,1.3,44.5,0
127,Pinsir,Bug,,1.5,55,0
128,Tauros,Normal,,1.4,88.4,0
129,Magikarp,Water,,0.9,10,0
130,Gyarados,Water,Flying,6.5,235,0
131,Lapras,Water,Ice,2.5,220,0
132,Ditto,Normal,,0.3,4,0
133,Eevee,Normal,,0.3,6.5,0
134,Vaporeon,Water,,1,29,0
135,Jolteon,Electric,,0.8,24.5,0
136,Flareon,Fire,,0.9,25,0
137,Porygon,Normal,,0.8,36.5,0
138,Omanyte,Rock,Water,0.4,7.5,0
139,Omastar,Rock,Water,1,35,0
140,Kabuto,Rock,Water,0.5,11.5,0
141,Kabutops,Rock,Water,1.3,40.5,0
142,Aerodactyl,Rock,Flying,1.8,59,0
143,Snorlax,Normal,,2.1,460,0
144,Articuno,Ice,Flying,1.7,55.4,1
145,Zapdos,Electric,Flying,1.6,52.6,1
146,Moltres,Fire,Flying,2,60,1
147,Dratini,Dragon,,1.8,3.3,0
148,Dragonair,Dragon,,4,16.5,0
149,Dragonite,Dragon,Flying,2.2,210,0
150,Mewtwo,Psychic,,2,122,1
A Pandas DataFrame is a two-dimensional, tabular data structure that works like a spreadsheet with rows and columns.
A Series is a one-dimensional labeled array that can hold data of any type. Think of it like a single column in a spreadsheet.
Each value in a Series has an associated index label (like row numbers, but can be customized).
This is an introduction to how to get started using Pandas. It's a Python library for working with tabular data.
Make sure to download the Pandas package by typing the following into a terminal:
python -m pip install pandas
This video serves as an introduction to the NumPy Python library. Weโll cover the basics of NumPy so you can start working with it on your own. After finishing this video, I recommend learning either Pandas, linear algebra, or more advanced NumPy topics.
00:00:00 introduction to NumPy ๐ข
00:05:07 multidimensional arrays ๐ง
00:12:54 slicing โ๏ธ
00:24:04 arithmetic โ๏ธ
00:33:21 broadcasting ๐ก
00:39:42 aggregate functions ๐
00:43:48 filtering ๐งฒ
00:52:03 random numbers ๐ฒ
Copyright Disclaimer:
This video is the intellectual property of Bro Code. All rights reserved. No part of this video may be reproduced, distributed, or transmitted in any form or by any means, including but not limited to recording, uploading, or other electronic or mechanical methods, without my written permission, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law.
Filtering = Refers to the process of selecting elements from an array that match a given condition
import numpy as np
# Aggregate functions = summarize data and typically return a single value
array = np.array([[1, 2, 3, 4, 5],
[6, 7, 8, 9, 10]])
print(np.sum(array)) # Sum of all elements
print(np.mean(array)) # Average of all elements
print(np.std(array)) # Measure of spread
print(np.var(array)) # Square of standard deviation
print(np.min(array)) # Smallest value
print(np.max(array)) # Largest value
print(np.argmin(array)) # Position (flattened) of smallest
print(np.argmax(array)) # Position (flattened) of largest
print(np.sum(array, axis=0)) # sum column-wise (vertically)
print(np.sum(array, axis=1)) # sum row-wise (horizontally)
Random numbers in NumPy are useful for simulations,
modeling, applying random transformations, and testing purposes.
rng = np.random.default_rng()
print(rng.integers(low=1, high=7, size=(3, 4))) # 3x4 array of Ints
np.random.seed()
print(np.random.uniform(low=-1, high=1, size=(3, 2))) # floats between 2 values
# Shuffle
array = np.array([1, 2, 3, 4, 5])
rng.shuffle(array)
print(array)
# Random Choice
fruits = np.array(["๐", "๐", "๐", "๐ฅฅ", "๐"])
print(rng.choice(fruits, size=(3, 3)))
Broadcasting allows NumPy to perform operations on arrays with different shapes by virtually expanding dimensions, so they match the larger array's shape.
The dimensions have the same size.
OR
One of the dimensions has a size of 1.
The purpose of arithmetic in NumPy is to perform fast, element-wise operations on entire arrays without writing loops.
00:00:00 scalar arithmetic
00:02:03 vectorized math functions
00:03:50 EXERCISE
00:05:08 element-wise arithmetic
00:06:39 comparison operators
Slicing in NumPy allows you to extract portions of an array using a [start:stop:step] syntax. It works similarly to Python lists but is more powerful, especially for multi-dimensional arrays.
00:00:00 row slicing
00:05:08 column slicing
00:08:38 row & column slicing
import numpy as np
array = np.array([[['A', 'B', 'C'], ['D', 'E', 'F'], ['G', 'H', 'I']],
[['J', 'K', 'L'], ['M', 'N', 'O'], ['P', 'Q', 'R']],
[['S', 'T', 'U'], ['V', 'W', 'X'], ['Y', 'Z', ' ']]])
print(array.ndim) #returns number of dimensions
print(array.shape) #returns a tuple of integers that represent the shape
word = array[0, 0, 0] + array[2, 0, 0] + array[2, 0, 0]
print(word)
This is an introduction to how to get started working with NumPy
1. open a terminal
2. pip install numpy
3. import numpy as np
4. array = np.array([1, 2, 3, 4])
An easy way to convert decimal to hexadecimal is by repeatedly dividing the original number by 16 and keeping track of the remainders. Then convert each remainder to its hexadecimal equivalent.
An easy way to convert decimal to hexadecimal is by repeatedly dividing the original number by 16 and keeping track of the remainders. Then convert each remainder to its hexadecimal equivalent.
An easy way to convert decimal to octal is by repeatedly dividing the original number by 8 and keeping track of the remainders.
Octal is used for file permissions in Unix/Linux and older computer architectures.
An easy way to convert decimal to octal is by repeatedly dividing the original number by 8 and keeping track of the remainders.
Octal is used for file permissions in Unix/Linux and older computer architectures.
An easy way to convert decimal to binary is by repeatedly dividing the original number by 2 and keeping track of the remainders.
An easy way to convert decimal to binary is by repeatedly dividing the original number by 2 and keeping track of the remainders.
Hexadecimal is a concise way to represent binary data. It's used in memory addresses, color codes, MAC addresses, and UUIDs.
Hexadecimal is a concise way to represent binary data. It's used in memory addresses, color codes, MAC addresses, and UUIDs.
Octal is used for file permissions in Unix/Linux and older computer architectures.
This is how I would explain the steps to convert octal to decimal to a beginner.
Octal is used for file permissions in Unix/Linux and older computer architectures.
This is how I would explain the steps to convert octal to decimal to a beginner.
This is how I would explain how to convert binary to decimal to a beginner.
This is how I would explain binary to someone
(00:00:00) introduction to C programming โ
(00:00:41) VSCode download
(00:01:52) new project folder
(00:02:29) main.c
(00:02:46) helpful VSCode extensions
(00:04:11) open VSCode terminal
(00:04:22) gcc compiler (Windows)
(00:05:11) clang compiler (Mac)
(00:05:46) gcc compiler (Linux)
(00:06:28) gcc compiler download (Windows)
(00:08:40) set PATH (Windows)
(00:09:53) your first C program
(00:15:04) variables โ
(00:35:06) format specifiers ๐
(00:44:15) arithmetic operators โ
(00:50:40) user input โจ
(01:06:54) โญ shopping cart program ๐
(01:15:38) โญ mad libs game ๐
(01:25:25) math functions ๐งฎ
(01:30:40) โญ circle calculator program โช
(01:36:44) โญ compound interest calculator ๐ฐ
(01:44:28) if statements ๐ค
(01:55:25) โญ weight converter ๐
(02:02:36) โญ temperature program ๐ก
(02:10:27) switches ๐ก
(02:18:34) nested if statements ๐
(02:26:35) โญ calculator ๐ฉ
(02:34:23) logical operators โ
(02:41:49) functions ๐
(02:51:45) return ๐
(03:00:05) variable scope ๐
(03:05:26) function prototypes ๐
(03:10:31) while loops โพ
(03:21:57) for loops ๐
(03:27:56) break & continue ๐
(03:30:16) nested loops โฟ
(03:40:00) random numbers ๐ฒ
(03:46:01) โญ number guessing game โ
(03:53:30) โญ rock paper scissors ๐ฟ ๐ โ
(04:05:40) โญ banking program ๐ต
(04:21:11) arrays ๐
(04:32:17) arrays and user input โก
(04:37:56) 2D arrays โฌ
(04:46:03) arrays of strings ๐งต
(04:58:44) โญ quiz game ๐ฏ
(05:13:50) ternary operator โ
(05:21:58) typedef ๐
(05:27:02) enums ๐
(05:35:54) structs ๐ฆ
(05:48:08) arrays of structs ๐
(05:54:48) pointers ๐
(06:02:55) write files โ
(06:08:50) read files ๐
(06:15:14) malloc ๐ข
(06:24:46) calloc ๐งน
(06:31:33) realloc ๐ข
(06:43:23) โญ digital clock โ
IDE: code.visualstudio.com
gcc for windows: msys2.org
Copyright Disclaimer:
This video is the intellectual property of Bro Code. All rights reserved. No part of this video may be reproduced, distributed, or transmitted in any form or by any means, including but not limited to recording, uploading, or other electronic or mechanical methods, without my written permission, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law.
This is a beginner's introduction to C programming
00:00:00 introduction
00:00:41 VSCode download
00:01:52 new project folder
00:02:29 main.c
00:02:46 helpful VSCode extensions
00:04:11 open VSCode terminal
00:04:22 gcc compiler (Windows)
00:05:11 clang compiler (Mac)
00:05:46 gcc compiler (Linux)
00:06:28 gcc compiler download (Windows)
00:08:40 Set PATH (Windows)
00:09:53 Your first C program
IDE: code.visualstudio.com
gcc for windows: msys2.org
// array of structs = Array where each element contains a struct {}
// Helps organize and groups together related data
Car cars[] = {{"Mustang", 2025, 32000},
{"Corvette", 2026, 68000},
{"Challenger", 2024, 29000}};
// variable scope = Refers to where a variable is recognized and accessible.
// Variables can share the same name if
// they're in different scopes {}
00:00:00 intro
00:00:53 setup
00:05:55 realloc demo
// realloc() = Reallocation.
// Resize previously allocated memory
// realloc(ptr, bytes)
// calloc() = Contiguous Allocation.
// Allocates memory dynamically and sets all allocated bytes to 0.
// malloc() is faster, but calloc() leads to less bugs
// calloc(#, size)
This is a beginner's project to help you understand and practice using structs, time functions, and pointers.
// malloc() = A function in C that dynamically allocates
// a specified number of bytes in memory
char *grades = malloc(number * sizeof(char));
// READ A FILE
FILE *pFile = fopen("input.txt", "r");
char buffer[1024] = {0};
if(pFile == NULL){
printf("Could not open file\n");
return 1;
}
while(fgets(buffer, sizeof(buffer), pFile) != NULL){
printf("%s", buffer);
}
fclose(pFile);
return 0;
// WRITE A FILE
FILE *pFile = fopen("output.txt", "w");
char text[] = "BOOTY BOOTY BOOTY\nROCKIN' EVERYWHERE!";
if(pFile == NULL){
printf("Error opening file\n");
return 1;
}
fprintf(pFile, "%s", text);
printf("File was written successfully!\n");
fclose(pFile);
return 0;
void birthday(int* age);
int main() {
// pointer = A variable that stores the memory address of another variable.
// Benefit: They help avoid wasting memory by allowing you to pass
// the address of a large data structure instead of copying the entire data.
int age = 25;
int *pAge = &age;
birthday(pAge);
printf("You are %d years old", age);
return 0;
}
void birthday(int* age){
// pass by reference
(*age)++;
}
typedef struct{
char name[50];
int age;
float gpa;
bool isFullTime;
}Student;
void printStudent(Student student);
int main() {
Student student1 = {"Spongebob", 30, 2.5, true};
Student student2 = {"Patrick", 36, 1.0, false};
Student student3 = {"Squidward", 48, 3.2, false};
Student student4 = {0};
strcpy(student4.name, "Sandy");
student4.age = 27;
student4.gpa = 4.0;
student4.isFullTime = true;
printStudent(student1);
printStudent(student2);
printStudent(student3);
printStudent(student4);
return 0;
}
void printStudent(Student student){
printf("Name: %s\n", student.name);
printf("Age: %d\n", student.age);
printf("GPA: %.2f\n", student.gpa);
printf("Full-time: %s\n", (student.isFullTime) ? "Yes" : "No");
printf("\n");
}
// enum = A user-defined data type that consists
// of a set of named integer constants.
// Benefit: Replaces numbers with readable names
typedef int Number;
typedef char String[50];
typedef char Initials[3];
int main() {
// typedef = reserved keyword that gives an existing datatype a "nickname"
// Helps simplify complex types and improves code readability
// typedef existing_type new_name;
// Example 1
Number x = 3;
Number y = 4;
Number z = x + y;
printf("%d", z);
// Example 2
String name = "Bro Code";
printf("%s", name);
// Example 3
Initials user1 = "BC";
Initials user2 = "SS";
Initials user3 = "PS";
Initials user4 = "ST";
printf("%s\n", user1);
printf("%s\n", user2);
printf("%s\n", user3);
printf("%s\n", user4);
return 0;
}


