Last-N-Rows

Sat 17 May 2025

title: "Last N 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('data1.csv')
df
capacity score length
0 1 …

Category: data-wrangling

Read More

Last-Nth-To-First-Row

Sat 17 May 2025

title: "Last nth to last second" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
df = pd.read_csv('data1.csv')
df
capacity score length …

Category: data-wrangling

Read More

Loc With Boolean

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

Max-As-New-Column

Sat 17 May 2025

title: "Max 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

Min-Max-Avg-As-New-Columns

Sat 17 May 2025

title: "Min Max Avg as new Columns" 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 …

Category: data-wrangling

Read More

Nth-Row

Sat 17 May 2025

title: "Get Nth 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('data1.csv')
df
capacity score length
0 1 …

Category: data-wrangling

Read More

Pandas Version

Sat 17 May 2025

title: "Pandas Version" author: "Rj" date: 2019-04-24 description: "-" type: technical_note draft: false


import pandas as pd
pd.__version__
'0.24.2'
pd.show_versions(as_json=False)
INSTALLED VERSIONS
------------------
commit: None
python: 3.6.8.final.0
python-bits: 64
OS: Darwin
OS-release: 18.5.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL …

Category: data-wrangling

Read More

Pandas-With-Numpy-Zeros

Sat 17 May 2025

title: "Pandas with Numpy Zeros" author: "Rj" date: 2019-04-20 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
dtype = [('Col1','int32'), ('Col2','float32'), ('Col3','float32')]
values = np.zeros(20, dtype=dtype)
index = ['Row'+str(i) for i in range(1, len(values)+1)]
df = pd.DataFrame …

Category: data-wrangling

Read More

Pandas-With-Random-Int

Sat 17 May 2025

title: "Pandas with Random Int" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
df = pd.DataFrame(np.random.randint(0, 100, size=(3, 2)), columns=list('xy'))
df

Category: data-wrangling

Read More

Random-Int-Single-Param

Sat 17 May 2025

title: "Random Param Single Param" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
df = pd.DataFrame(np.random.randint(5, size = (5, 4)))
df

Category: data-wrangling

Read More
Page 4 of 6

« Prev Next »