Skip to content

Instantly share code, notes, and snippets.

View pandas_challenge_8.py
df = pd.read_csv("https://github.com/selva86/datasets/raw/master/economics.csv")
df.head()
View Pandas_Challenge_7.py
import pandas as pd
import numpy as np
df = pd.read_csv('Datasets\Titanic.csv').sample(50, random_state=100)
n_missing = np.random.randint(4, 15, 1)
for i in range(n_missing):
row = np.random.randint(1, df.shape[0])
df.at[row, "Age"] = pd.NA
View Pandas_Challenge_6.py
# Solution
import pandas as pd
import numpy as np
df1 = pd.read_csv("Datasets/table1.csv")
df2 = pd.read_csv("Datasets/table2.csv")
View Pandas_Challenge_5.py
# Input
import numpy as np
np.random.seed(100)
arr = pd.Series(np.random.normal(10, 3, (100)))
arr.head()
View Pandas_Challenge_4.py
import pandas as pd
df = pd.read_csv('Datasets/Tips100.csv')
df.head()
View Pandas_Challenge_3.py
import pandas as pd
df = pd.read_csv('Datasets/Tips100.csv')
df.head()
View Pandas_Challenge_2.py
import numpy as np
import pandas as pd
dfc = pd.DataFrame(np.zeros((1000, 1000), dtype='int'))
View pandas_mini_1.py
# 1
index = [1,2,3,4,5]
col1 = list('abcde')
col2 = list('pqrst')
# 2
# column names: 'name' and 'age'
lst = [['Bunny', 25], ['Sunny', 30],
['Funny', 26], ['Hunny', 22]]
View update_ner_model_challenge.py
TRAIN_DATA = [("Pizza is a common fast food.", {"entities": [(0, 5, "FOOD")]}),
("We ate dosa yesterday.", {"entities": [(7, 11, "FOOD")]}),
("Pasta is an italian recipe", {"entities": [(0, 5, "FOOD")]}),
("China's noodles are very famous", {"entities": [(8,15, "FOOD")]}),
("Shrimps are famous in China too", {"entities": [(0,7, "FOOD")]}),
("Lasagna is another classic of Italy", {"entities": [(0,7, "FOOD")]}),
("Unagi is a famous seafood of Japan", {"entities": [(0,5, "FOOD")]}),
("Tempura , Soba are other famous dishes of Japan", {"entities": [(0,7, "FOOD")]}),
("Udon is a healthy type of noodles", {"entities": [(0,4, "ORG")]}),
("Chocolate soufflé is extremely famous french cuisine", {"entities": [(0,17, "FOOD")]}),
View custom_ner_challenge.py
TRAIN_DATA =[ ("Pizza is a common fast food.", {"entities": [(0, 5, "FOOD")]}),
("Pasta is an italian recipe", {"entities": [(0, 5, "FOOD")]}),
("China's noodles are very famous", {"entities": [(8,14, "FOOD")]}),
("Shrimps are famous in China too", {"entities": [(0,7, "FOOD")]}),
("Lasagna is another classic of Italy", {"entities": [(0,7, "FOOD")]}),
("Sushi is extemely famous and expensive Japanese dish", {"entities": [(0,5, "FOOD")]}),
("Unagi is a famous seafood of Japan", {"entities": [(0,5, "FOOD")]}),
("Tempura , Soba are other famous dishes of Japan", {"entities": [(0,7, "FOOD")]}),
("Udon is a healthy type of noodles", {"entities": [(0,4, "ORG")]}),
("Chocolate soufflé is extremely famous french cuisine", {"entities": [(0,17, "FOOD")]}),