After class 4-29-2025
This commit is contained in:
parent
83c99e9695
commit
7665d58442
7 changed files with 29 additions and 1 deletions
18
bigos/lecture20250422/numpy01/numpyExample02.py
Normal file
18
bigos/lecture20250422/numpy01/numpyExample02.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
import numpy as np
|
||||
|
||||
list_of_lists = [[1, 2, 3], [4, 5, 6]]
|
||||
array_2d = np.array(list_of_lists)
|
||||
arr = np.array([1, 2, 3, 4, 5])
|
||||
|
||||
print(arr)
|
||||
print(array_2d)
|
||||
|
||||
arr = np.array([[1, 2, 3], [4, 5, 6]])
|
||||
|
||||
print(arr)
|
||||
|
||||
|
||||
print(f"The numpy version is {np.__version__}")
|
||||
|
||||
print(type(arr))
|
||||
|
3
bigos/lecture20250429/1CreateBasicSeries/series02a.py
Normal file
3
bigos/lecture20250429/1CreateBasicSeries/series02a.py
Normal file
|
@ -0,0 +1,3 @@
|
|||
import pandas as pd
|
||||
s1 = pd.Series([1.25,1.75,2.25,2.75,3.25],index=['2020','2021','2022','2023','2024'])
|
||||
print(s1)
|
|
@ -2,4 +2,7 @@ import pandas as pd
|
|||
s1 = pd.Series([1.25,1.75,2.25,2.75,3.25],index=['a','b','c','d','e'])
|
||||
print(s1)
|
||||
s3 = s1+5
|
||||
print(s3)
|
||||
|
||||
s3 = s1+20
|
||||
print(s3)
|
|
@ -3,6 +3,7 @@ name = pd.Series(['Bob','Sam'])
|
|||
team = pd.Series(['Wild Bunch','Sleepy Team'])
|
||||
dic = {'Name':name,'Team':team}
|
||||
|
||||
print("The dictionary is ",dic)
|
||||
df = pd.DataFrame(dic)
|
||||
|
||||
print("Create data frame from a dictionary")
|
||||
|
|
|
@ -3,3 +3,4 @@ import pandas as pd
|
|||
df = pd.DataFrame()
|
||||
print("Create empty data frame")
|
||||
print(df)
|
||||
|
||||
|
|
|
@ -21,3 +21,5 @@ print(" ========== Column wise data =========")
|
|||
for (col_index, col_value) in df.items() :
|
||||
print("\n Col index is :",col_index)
|
||||
print("\n Col Value is: ",col_value)
|
||||
|
||||
print("Describe\n",df.describe())
|
|
@ -30,7 +30,7 @@ def url_get_contents(url):
|
|||
# https://stackoverflow.com/questions/27835619/urllib-and-ssl-certificate-verify-failed-error
|
||||
ssl._create_default_https_context = ssl._create_unverified_context
|
||||
|
||||
webpage = url_get_contents('https://cset2.stcc.edu/~csetuser/pandas/index.html')
|
||||
webpage = url_get_contents('https://cset2.stcc.edu/~csetuser/pandas/index2.html')
|
||||
|
||||
# Read the HTML file into a Pandas dataframe
|
||||
soup = BeautifulSoup(webpage, 'html.parser')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue