Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Questions | Answers | Discussions | Knowledge sharing | Communities & more.
Write a program in Python to check if a sequence is a Palindrome.
a=input("enter sequence") b=a[::-1] if a==b: print("palindrome") else: print("Not a Palindrome")
a=input(“enter sequence”)
See lessb=a[::-1]
if a==b:
print(“palindrome”)
else:
print(“Not a Palindrome”)
Write a sorting algorithm for a numerical dataset in Python.
list = ["1", "4", "0", "6", "9"] list = [int(i) for i in list] list.sort() print (list)
list = [“1”, “4”, “0”, “6”, “9”]
See lesslist = [int(i) for i in list]
list.sort()
print (list)
Write a program in Python to produce Star triangle.
def pyfunc(r): for x in range(r): print(' '*(r-x-1)+'*'*(2*x+1)) pyfunc(9)
def pyfunc(r):
See lessfor x in range(r):
print(‘ ‘*(r-x-1)+’*’*(2*x+1))
pyfunc(9)
Write a program in Python to check if a number is prime.
a=int(input("enter number")) if a=1: for x in range(2,a): if(a%x)==0: print("not prime") break else: print("Prime") else: print("not prime")
a=int(input(“enter number”))
See lessif a=1:
for x in range(2,a):
if(a%x)==0:
print(“not prime”)
break
else:
print(“Prime”)
else:
print(“not prime”)
How to delete row and column from a dataframe in Pandas?
A Pandas dataframe is a two dimensional data structure which allows you to store data in rows and columns. To drop a row or column in a dataframe, you need to use the drop() method available in the dataframe. Syntax: DataFrame.drop(labels=None, axis=0, index=None, columns=None, level=None, inplace=FRead more
A Pandas dataframe is a two dimensional data structure which allows you to store data in rows and columns. To drop a row or column in a dataframe, you need to use the drop() method available in the dataframe.
Syntax: DataFrame.drop(labels=None, axis=0, index=None, columns=None, level=None, inplace=False, errors=’raise’)
Parameters:
labels: String or list of strings referring row or column name.
axis: int or string value, 0 ‘index’ for Rows and 1 ‘columns’ for Columns.
index or columns: Single label or list. index or columns are an alternative to axis and cannot be used together. level: Used to specify level in case data frame is having multiple level index.
inplace: Makes changes in original Data Frame if True.
errors: Ignores error if any value from the list doesn’t exists and drops rest of the values when errors = ‘ignore’
Return type: Dataframe with dropped values.
See lessHow to get items of series A that are not available in another series B?
import pandas as pd # Creating 2 pandas Series ps1 = pd.Series([2, 4, 8, 20, 10, 47, 99]) ps2 = pd.Series([1, 3, 6, 4, 10, 99, 50]) print("Series 1:") print(ps1) print("nSeries 2:") print(ps2) # Using Bitwise NOT operator along # with pandas.isin() print("nItems of Series 1 not present in Series 2:"Read more
import pandas as pd
# Creating 2 pandas Series
ps1 = pd.Series([2, 4, 8, 20, 10, 47, 99])
ps2 = pd.Series([1, 3, 6, 4, 10, 99, 50])
print(“Series 1:”)
print(ps1)
print(“nSeries 2:”)
print(ps2)
# Using Bitwise NOT operator along
See less# with pandas.isin()
print(“nItems of Series 1 not present in Series 2:”)
res = ps1[~ps1.isin(ps2)]
print(res)
Write a program in Python to execute the Bubble sort algorithm.
def bs(a): # a = name of list b=len(a)-1nbsp; # minus 1 because we always compare 2 adjacent values for x in range(b): for y in range(b-x): a[y]=a[y+1] a=[32,5,3,6,7,54,87] bs(a)
def bs(a):
# a = name of list
b=len(a)-1nbsp;
# minus 1 because we always compare 2 adjacent values
for x in range(b):
for y in range(b-x):
a[y]=a[y+1]
a=[32,5,3,6,7,54,87]
See lessbs(a)
What is reindexing in Pandas?
You can modify a DataFrame’s row and column index using reindexing in Pandas. Indexes can be used with reference to many index DataStructure associated with several pandas series or pandas DataFrame.
You can modify a DataFrame’s row and column index using reindexing in Pandas. Indexes can be used with reference to many index DataStructure associated with several pandas series or pandas DataFrame.
See lessHow to create a series from the dictionary object in pandas?
To make a series from a dictionary, simply pass the dictionary to the command pandas.Series method. The keys of the dictionary form the index values of the series and the values of the dictionary form the values of the series.
To make a series from a dictionary, simply pass the dictionary to the command pandas.Series method. The keys of the dictionary form the index values of the series and the values of the dictionary form the values of the series.
See lessin publishing what is the verse?
left page - recto right page is the verse in publishing.
left page – recto right page is the verse in publishing.
See less