Archive
Nikon S9900 shots – 2
Subject: Nikon S9900 Cold Coffee shot
This Shot: Cold Coffee, using Nikon S9900.
Camera in Hand, F: 3.7, ISO: 400, Shutter: 1/15s
|
By: Ali Radwani
Python: Generate your Data-Set
Learning : Python, pandas, function
Subject: Generate your CSV dataset using python
[NOTE: To keep the code as simple as we can, We WILL NOT ADD any user input Varevecations. Assuming that our user will Enter the right inputs.]
The Story: last week i was reading about Data Cleaning, Deep Learning and Machine Learning, and for all we need some data to play with and testing our code. There are several sites providing a free (to certain limits) Data-set. But while i was working, it just come to my mind Why not to write a code to generate some Fake data-set.
Before I start: The main question was “What is the subject of the data” or Data about What? This is the main question that will guide us to write our code, and tha answer was very..very fast 🙂 .. at that moment I was holding my Coffee Mug, and just jump to my mind, Data about Coffee … Coffee Consumption. So we are taking the data of Coffee Consumption from a Coffee-Shop, the coffee-shop is collecting the following data: Date-Time (of the order), Coffee-Name, Coffee-Type, Coffee-size, Sex, Rank. Here is in more details..
Dat-Time: Date and Time of Order, Date format: dd-mm-yyyy, the Time format: hh:mm (24h)
Coffee-Name: Such as: [black, latte, espresso, americano, cappuccino, mocha, lungo, flat white, irish, macchiato,ristretto, iced coffee]
Coffee-Type: 3n1 , pods, grounded
Coffee Size: samll, medium, large, venti
Sex: The person how order it male, female
Rank: if the customer drink the coffee in the shop, will ask for a ranks (1,10) 1:bad, 10:Grate
Scope of Work: We will write several functions to generate random data for each attribute we have, saving the data into a list, then combining all the lists in a pandas dataframe df and save the data_set df to a csv file. Later on we can re-call the file using pandas command df.read_csv(file_name) and manipulate the data.
.::.. Coding ..::.
Let’s start with Date-Time Function: def fake_date_time(from_y,to_y): In this function we will use a random.randint() to generate numbers for day’s, months and years, also for hours and minites. The function will take two arguments from_y, to_y and will return a string like this: dd-mm-yyyy hh:mm … here is the code ..
![]() |
Now,Coffee Name: def fake_coffee_name() : for Coffee Name I create a list of Coffee Names (from the net) and use random.choice(coffee_name_list) to select one from the list. this function is a one-line code .. here it is ..
# fake_coffee_name() function
def fake_coffee_name() :
"""
Function to randomly select one from the list.
Return coffee_name
"""
coffee_name_list = ['black', 'latte', 'espresso', 'americano', 'cappuccino',
'mocha', 'lungo', 'flat white', 'irish', 'macchiato', 'ristretto',
'iced coffee'
]
return random.choice(coffee_name_list)
Here are another two Functions def fake_coffee_type(): and def fake_coffee_size(): Both are using the random.choice to select from a list.. here is the code ..
]![]() |
More over, in out dataset we need another two variables sex and rank, both are simple and we don’t need to put them in separate function, we will call the random.choice(‘f’,’m’) to select between Male and Female, and random.randint (1,11) to select a Rank between (1 and 10). Here is the main part of the application, we will use a for loop and append all the returns from the function’s in a list (a list for each attribute) after that we will combine all the list in a dataset using pandas command. Here is the code..
# Main body of the application
# empty lists of the columns
d_d =[]
cn_d =[]
ct_d =[]
cs_d =[]
s_d =[]
r_d = []
number_of_rows = 1000
for x in range(1,number_of_rows):
d_d.append(fake_date_time(2000,2022))
cn_d.append(fake_coffee_name())
ct_d.append(fake_coffee_type())
cs_d.append(fake_coffee_size())
s_d.append(random.choice(['f','m']))
r_d.append(random.randint (1,11))
the_data ={'date_time':d_d, 'c_name':cn_d, 'c_type':ct_d, 'c_size':cs_d, 'sex':s_d, 'rank':r_d }
df = pd.DataFrame (the_data)
# to create a CSV file and save the data in it.
file_name = 'coffee_consumption_v1.csv'
df.to_csv(file_name, index=False)
print(f'\n\n The data been generated, a file named: {file_name} saved')
Now we have a file called: coffee_consumption_v1.csv saved in the same directory of the .py code file. Here is a sample of the data.
![]() |
We will stop here, and we will do another post to apply pandas commands over the dataset.
..:: Have Fun with Coding ::.. 🙂
To Download my Python code (.py) files Click-HereAlso the Date-Set coffee_consumption_v1 file (.csv) files is available in the same page.
By: Ali Radwani
30 day of ML with Kaggle
Last week during some search on YouTube, I fond a Two Minutes video talking about a new course on Kaggle that will start on 2nd of August, the Course is about Machine Learning ML with Python in a 30 Day’s. I was not sure if it is Free or Not, later on I fond that it is FREE, so I register to it.
And as a part of the program, we will complete three courses: Python, Intro to Machine Learning, and Intermediate Machine Learning.
My time is very tight, and I don’t know if I can continue to complete the required stages/assignments on time for each stage of the program.. Sure I will Try my best.
Now, I am writing this post in 3rd of August 2021, 6:00pm (GMT+3) .. First want to say they did not start on time, delay 1 day! so today was Day 1 , we start with introduction on Kaggle, the participate in first competition and submitting our solution.
I will try to summarize and drop a post every two-three days .. or so ..
:: Have Fun .. Code with Python ..::
Ali,
Another Sketch Challenge: T for Toucan
There is a lot of sketching challeng in the twitter asking the readers to draw/sketch something inspired by it.
I fond the @AnimalAlphabets there challenge this week is Toucan Bird.
So here is my sketch using pencil then black Pen and shading using black fine pin, it takes around 55min. More Sketches on my Sketch page ..
you may Follow me on Twitter @h_ta3kees
Here is my sketch..
Nikon S9900 shots – 3
Subject: Nikon S9900 Macro – Coffee Foam shot
This Shot: Macro on Coffee Foam, using Nikon S9900.
…Click Image to Enlarge… Camera in Hand, F:4.2 , ISO:320 , Shutter: 1/30s
|
By: Ali Radwani
Another sketch challenge: S for Sloth
There is a lot of sketching challeng in the twitter asking the readers to draw/sketch something inspired by it.
I fond the @AnimalAlphabets there challenge this week is SLOTH.
So here is my sketch using pencil then black Pen, and some watercolor, it takes around 45min. More Sketches on my Sketch page ..
you may Follow me on Twitter @h_ta3kees
Here is my sketch..
Nikon S9900 shots – 5
Subject: Nikon S9900 Milk and Coffee
This Shot: I place my Milk Mug in the sun-light coming from a window, the camera on graound level and i took the shot using BW-color from the camera.
…Click Image to Enlarge… Camera in Hand, F:4 , ISO:160 , Shutter: 1/30s
|
::.. To see all my Nikon S9900 Photos Click-Here
::.. To see all my Nikon D7100 Photos Click-Here
::.. To see all my Nikon D90 Photos Click-Here
By: Ali Radwani
Nikon S9900 Macro shot – 1
Subject: Nikon S9900 Macro shot
This Shot: A Macto-Shot on Fruit, using Nikon S9900. Camera in Hand, F:4.2, ISO:125, Shutter:1/4s
Camera in Hand, F:4.2, ISO:125, Shutter:1/4s
|
By: Ali Radwani
Python: Random Pixel Color – P2
Learning : Python, Math
Subject: Random Coloring Pixels
[NOTE: To keep the code as simple as we can, We WILL NOT ADD any user input Varevecations. Assuming that our user will Enter the right inputs.]
Our last post about Random Pixel Color, we generate a Numpy Array of Row, Coloum and color then we Plot it on the screen [Read the Post Here], now in this post we will use some Math consepts to try if we can get some patterns out of ramdom Function.
Our Tools: In this post we will use the following:
1. Jupyter-NoteBook.
2. numpy.
3. random.
4. matplotlib.
5. PIL or Pillow.
In this version we will use “Fibonacci Sequence” Fibonacci Sequence is the sum of the two preceding ones, starting from 0 and 1 such as [1, 1, 2, 3, 5, 8, 13 … n], in our code we will have three variables:
cw: canvas width,
ch: canvas hight,
offset: the offset will be the value that will reset the Fibonacci Sequence to 1.
So, if we run the application, we will generate three numbers that will present the colors R,G,B (Will be Generated ONE time) then for each pixcel in (cw*ch) we will calculate a v as Fibonacci Sequence from fs1 =1, fs2 = 1 here is the code:
v = fs1 + fs2
fs1,fs2 = fs2, v
this value v will be added to the colors r,g,b (on each pixcel) untill the v is grater the the offset numbre that we pass to the Function. If v > offset then we will re-set the fs1 = 1, fs2 = 1,.. Here is the Code ..
|
Run No.1![]() |
Run No.2![]() |
Run No.3![]() |
Run No.4![]() |
The above is just 25×25 and i change the offset, feel free to download the code and change the numbers .. see what you will get …
..:: Have Fun with Coding ::.. 🙂
To Download my Python code (.py) files Click-Here
By: Ali Radwani
Camera: Nikon S9900
Subject: About My Nikon S9900 Camera
Effective pixels: 16.0 million
Image sensor: 1/2.3-in. type CMOSLens: NIKKOR lens with 30x optical zoom
Focal length: 4.5-135 mm
(angle of view equivalent to that of 25-750 mm lens in 35mm [135] format)Maximum aperture: f/3.7-6.4
Digital zoom: Up to 4x
(angle of view equivalent to that of approx. 3000 mm lens in 35mm [135] format)Vibration reduction
Autofocus (AF)
Macro mode: Approx. 1 cm (0.4 in.)Monitor 7.5 cm (3-in.) wide viewing angle TFT LCD with anti-reflection.
Storage: SD , SDHC , SDXC
Internal memory (approx. 473 MB)ISO 125-1600
ISO 3200, 6400 (available when using P, S, A, or M mode)More Specifications [Click Here]
![]() |
![]() |
![]() |
![]() |
I use the camera for a while, not sure why I stop, so i decided to start playing with it more, and post some output. So in coming weeks i will post some landscape and macro shots.
By: Ali Radwani

Follow me on Twitter..

















