java hashmap put does not work changes all values code example
Example 1: doest all the methos in interface need to implement c#
You have two choices:
- implement every method required by the interface
or
- declare the missing methods abstract in your class. This forces you
to declare your class abstract and, as a result, forces you to
subclass the class (and implement the missing methods) before you
can create any objects.
Example 2: how to make array of objects in java and use it
//create class
class enemies {
int marks;
}
//create object array
enemies[] enemiesArray = new enemies[7];
//assign value to object
enemiesArray[5] = new enemies(95);
Example 3: whow i fill the data if most values are nan in jupyter notebook
# import pandas
import pandas as pd
# make a sample data
list_of_rows = [
{'start_station': 1, 'end_station': 1},
{'start_station': None, 'end_station': 1},
{'start_station': 1, 'end_station': 2},
{'start_station': 1, 'end_station': 3},
{'start_station': 2, 'end_station': None},
{'start_station': 2, 'end_station': 3},
{'start_station': 2, 'end_station': 3},
]
# make a pandas data frame
df = pd.DataFrame(list_of_rows)
# define a function
def fill_NaNs_in_end_station(row):
if pd.isnull(row['end_station']):
start_station = row['start_station']
return df[df['start_station']==start_station].end_station.value_counts().first_valid_index()
return row['end_station']
# apply function to dataframe
df['end_station'] = df.apply(lambda row: fill_NaNs_in_end_station(row), axis=1)