Random-Int-With-2-Dim

Sat 17 May 2025

title: "Random Integer with 2 dimension" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
# Create Random integer between 1 to 100

df = pd.DataFrame(np.random.randint(0, 100, size=(2, 4)), columns=['A', 'B', 'C', 'D'])
df

Category: data-wrangling

Read More

Random-Integer

Sat 17 May 2025

title: "Random Integer between 2 and 10" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


import numpy as np
a = np.random.randint(2, 10, size=4)
print(a)
[8 4 5 3]

Score: 0

Category: data-wrangling

Read More

Select-Column-By-Index

Sat 17 May 2025

title: "Select Column By Index" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
df = pd.read_csv('abc.csv')
df
student language science maths …

Category: data-wrangling

Read More

Show-Negative-Values-Red

Sat 17 May 2025

title: "Show Negative values red" author: "Rj" date: 2019-09-05 description: "List Test" type: technical_note draft: false


import pandas as pd
data = {
    'Month' : [1, 2, 3],
    'Temp' : [7, -18, -20]
}
data
{'Month': [1, 2, 3], 'Temp': [7, -18, -20]}
type(data)
dict
df = pd.DataFrame(data)
df

Category: data-wrangling

Read More

Skip-A-Single-Row

Sat 17 May 2025

title: "Skip a single row" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
df = pd.read_csv('abc.csv')
df
student language science maths …

Category: data-wrangling

Read More

Skip-Multiple-Rows

Sat 17 May 2025

title: "Skip Multiple Rows" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
df = pd.read_csv('abc.csv')
df
student language science maths history …

Category: data-wrangling

Read More

Sort Rows

Sat 17 May 2025

title: "Sort Rows" author: "Rj" date: 2019-04-20 description: "List Test" type: technical_note draft: false


import pandas as pd
data = {
    'language' : [80, 67, 90],
    'maths' : [100, 78, 98],
    'science' : [98, 77, 56],
    'programming': [100, 100, 90]
}

index = ['chris', 'kevin', 'peter']
df = pd.DataFrame(data, index = index)
df

Category: data-wrangling

Read More

Split Frame

Sat 17 May 2025

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 …

Category: data-wrangling

Read More

String-To-Dataframe

Sat 17 May 2025

title: "String to Dataframe" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
from io import StringIO
content = """
    1, 2
    3, 4
    5, 6
"""
content
'\n    1, 2\n    3, 4\n    5, 6\n'
df = pd.read_csv(StringIO(content), header=None …

Category: data-wrangling

Read More

Sum-As-New-Column

Sat 17 May 2025

title: "Sum as a new column" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
df = pd.read_csv('abc.csv')
df
student language science …

Category: data-wrangling

Read More
Page 5 of 6

« Prev Next »