Dataframe-With-Radom-Data

Sat 17 May 2025

title: "DataFrame With Random Data" author: "Rj" date: 2019-04-24 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
import random
def xrange(x):
    return iter(range(x))
rnd_1 = [random.randrange(1, 20) for x in xrange(10)]
rnd_1
[16, 3, 18, 19, 1, 13, 17, 3 …

Category: data-wrangling

Read More

Dataype Downcasting

Sat 17 May 2025

title: "Datatype Downcasting" author: "Rj" date: 2019-04-24 description: "-" type: technical_note draft: false


import numpy as np
import pandas as pd
ds = pd.Series([1, np.nan, 3, 4, 5])
ds
0    1.0
1    NaN
2    3.0
3    4.0
4    5.0
dtype: float64
# ds = ds.astype('int …

Category: data-wrangling

Read More

Even-Rows-And-First-3-Columns

Sat 17 May 2025

title: "Even Rows and 3 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', sep=',', encoding='utf-8')
df

Category: data-wrangling

Read More

Fill-Na-With-Average

Sat 17 May 2025

title: "Fill NA with Average" author: "Rj" date: 2019-04-22 description: "-" type: technical_note draft: false


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

Category: data-wrangling

Read More

Fill-Random-Marks

Sat 17 May 2025

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


import numpy as np
import pandas as pd
datatype = [('Science', 'int32'), ('Maths', 'int32')]
current_values = np.zeros(3, dtype=datatype)
current_index = ['Row '+str(i) for i in range(1, 4)]
df = pd.DataFrame(current_values, index=current_index)
df

Category: data-wrangling

Read More

Filter-Between

Sat 17 May 2025

title: "Filter Between" author: "Rj" date: 2019-04-24 description: "-" type: technical_note draft: false


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

Category: data-wrangling

Read More

Filter-By-Single-Column

Sat 17 May 2025

title: "Filter by single 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.shape
(7, 5)
df

Category: data-wrangling

Read More

Filter-With-Query

Sat 17 May 2025

title: "Filter with Query" 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

Filter-With-Value-Comparison

Sat 17 May 2025

title: "Filter With Value Comparison" author: "Rj" date: 2019-04-24 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

First-Four-Rows-Of-Csv

Sat 17 May 2025

title: "First Four Rows of CSV" 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
Page 2 of 6

« Prev Next »