List-Files
title: "List Files"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
from os import listdir
from os.path import isfile, join
def list_files(mypath):
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
for x in onlyfiles:
print(x)
list_files('/tmp/datasets')
credit.zip
occupancy.zip …
Read More
List-Operations
title: "List Operations"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
list = [
"AB",
"CD",
"EF",
"GH",
"IJ",
"KL",
"MN",
"OP",
"QR",
"ST",
"UV",
"WX",
"YZ"
]
['AB', 'CD', 'EF', 'GH', 'IJ', 'KL', 'MN', 'OP', 'QR', 'ST', 'UV', 'WX', 'YZ']
# append to list
list.append("ABC")
Read More
List Ref
title: "List Reference"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
As b is referring to a, whatever is added to b, will be reflected to …
Read More
List-Remove
title: "Remove Item from list"
author: "Rj"
date: 2019-04-20
description: "-"
type: technical_note
draft: false
names = [
"Kevin",
"Peter",
"John"
]
['Kevin', 'Peter', 'John']
Score: 5
Read More
List Test
title: "List Test"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
entries = ['one', 2, 'three', False]
['one', 2, 'three', False]
entryTuple = (100, 200, 'three', 'four')
print(entryTuple)
(100, 200, 'three', 'four')
cities = ['Toronto', 'Monteal', 'Vancouver']
print(cities)
Read More
List Test 2
title: "List Test 2"
author: "Rj"
date: 2019-04-20
description: "List Test"
type: technical_note
draft: false
entries = ['one', 2, 'three', False]
['one', 2, 'three', False]
entryTuple = (100, 200, 'three', 'four')
print(entryTuple)
(100, 200, 'three', 'four')
cities = ['Toronto', 'Monteal', 'Vancouver']
print(cities)
Read More
List-With-Diff-Datatype
import pyutil as pyu
pyu.get_local_pyinfo()
'conda env: ml311; pyv: 3.11.10 (main, Oct 3 2024, 07:29:13) [GCC 11.2.0]'
print(pyu.ps2("haystack-ai ollama-haystack python-dotenv"))
haystack-ai==2.8.0
ollama-haystack is not installed in the current environment.
python-dotenv==1.0.1
lista = ["one", 2, "three …
Read More
List2Table
import pandas as pd
from IPython.display import display
# Example list of tuples
data = [
(1, 'Alice', 25),
(2, 'Bob', 30),
(3, 'Charlie', 35)
]
# Convert the list of tuples to a DataFrame
df = pd.DataFrame(data, columns=['ID', 'Name', 'Age'])
# Set display options
pd.set_option('display.max_rows', 100)
pd.set_option('display …
Read More
List2Table-D-Pandas
import pandas as pd
from IPython.display import display
# Example list of tuples
data = [
(1, 'Alice', 25),
(2, 'Bob', 30),
(3, 'Charlie', 35)
]
# Convert the list of tuples to a DataFrame
df = pd.DataFrame(data, columns=['ID', 'Name', 'Age'])
# Set display options
pd.set_option('display.max_rows', 100)
pd.set_option('display …
Read More
Loc With Boolean
title: "If Else Pandas"
author: "Rj"
date: 2019-04-24
description: "-"
type: technical_note
draft: false
source: http://pandas.pydata.org/pandas-docs/version/0.24/user_guide/cookbook.html#idioms
import numpy as np
import pandas as pd
df = pd.DataFrame({
'maths' : [80, 89, 90, 20],
'science' : [40, 50, 90, 100],
'language' : [20, 30 …
Read More