filmov
tv
Python Pandas 7 examples of filters and lambda apply
Показать описание
Python Pandas 7 examples of filters and lambda apply
Python pandas dataframes
* show all
* count values in pandas dataframe
* count rows of pandas dataframe
* filter pandas dataframe
* python apply lambda expression on pandas dataframe
Example
import pandas as pd
foo = [{
'Language': 'Python',
'Percent grow': 56
}, {
'Language': 'Java',
'Percent grow': 34
}, {
'Language': 'C',
'Percent grow': 25
}, {
'Language': 'C++',
'Percent grow': 12
}, {
'Language': 'go',
'Percent grow': 5
}]
df = pd.DataFrame(foo, index=pd.RangeIndex(0, len(foo)))
print(df)
print('--------------')
print(df['Language'])
print('--------------')
print(df['Language'] == 'Java')
print('--------------')
print('--------------')
mylambda = lambda x: x in ['C', 'C++']
print('--------------')
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Code store
Socials
If you really find this channel useful and enjoy the content, you're welcome to support me and this channel with a small donation via PayPal.
Python pandas dataframes
* show all
* count values in pandas dataframe
* count rows of pandas dataframe
* filter pandas dataframe
* python apply lambda expression on pandas dataframe
Example
import pandas as pd
foo = [{
'Language': 'Python',
'Percent grow': 56
}, {
'Language': 'Java',
'Percent grow': 34
}, {
'Language': 'C',
'Percent grow': 25
}, {
'Language': 'C++',
'Percent grow': 12
}, {
'Language': 'go',
'Percent grow': 5
}]
df = pd.DataFrame(foo, index=pd.RangeIndex(0, len(foo)))
print(df)
print('--------------')
print(df['Language'])
print('--------------')
print(df['Language'] == 'Java')
print('--------------')
print('--------------')
mylambda = lambda x: x in ['C', 'C++']
print('--------------')
---------------------------------------------------------------------------------------------------------------------------------------------------------------
Code store
Socials
If you really find this channel useful and enjoy the content, you're welcome to support me and this channel with a small donation via PayPal.