Data science | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Data science

Hello Data scientists Help me out with the following import numpy as np lst = [float(x) if x != 'nan' else np.NaN for x in input().split()] df = pd.Series(lst) df = df.fillna(df.mean()).round(1) print(df)

30th Mar 2021, 7:28 AM
Joshua chola
Joshua chola - avatar
11 Answers
30th Mar 2021, 8:02 AM
ChaoticDawg
ChaoticDawg - avatar
+ 12
import numpy as np import pandas as pd lst = [float(x) if x != 'nan' else np.NaN for x in input().split()] arr=np.asarray(lst) pd=pd.Series(arr) p=pd.fillna(pd.mean().round(1)) print(p)
25th Apr 2021, 8:49 PM
Areeba Ayub Khan
Areeba Ayub Khan - avatar
+ 3
Did you forget to import pandas? What is the issue? Give us some examples of input and expected output etc.
30th Mar 2021, 7:40 AM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Your code seems to work when I supply the missing pandas import
30th Mar 2021, 7:59 AM
ChaoticDawg
ChaoticDawg - avatar
+ 1
ChaoticDawg Imputing missing values. In the real world, you will often need to handle missing values. One way to impute (i.e., fill) the numerical column is to replace the null values with its mean. Task Given a list of numbers including some missing values, turn it into a pandas dataframe, impute the missing values with the mean, and finally return the dataframe. Input Format A list of numbers including one or more string "nan" to indicate a missing value. Output Format A list of imputed values where all values are rounded to its first decimal place. Sample Input 3 4 5 3 4 4 nan Sample Output 0 3.0 1 4.0 2 5.0 3 3.0 4 4.0 5 4.0 6 3.8 dtype: float64
30th Mar 2021, 7:45 AM
Joshua chola
Joshua chola - avatar
0
ChaoticDawg Insted of numpy i should import pandas or i dont get i.
30th Mar 2021, 8:01 AM
Joshua chola
Joshua chola - avatar
0
ChaoticDawg i appreciate that
30th Mar 2021, 8:06 AM
Joshua chola
Joshua chola - avatar
0
Hello
15th Aug 2021, 3:38 AM
Vamsi Krishna
0
Imputing missing values. In the real world, you will often need to handle missing values. One way to impute (i.e., fill) the numerical column is to replace the null values with its mean. Task Given a list of numbers including some missing values, turn it into a pandas series, impute the missing values with the mean, and finally return the series. Input Format A list of numbers including one or more string "nan" to indicate a missing value. Output Format A list of imputed values where all values are rounded to its first decimal place. Sample Input 3 4 5 3 4 4 nan Sample Output 0 3.0 1 4.0 2 5.0 3 3.0 4 4.0 5 4.0 6 3.8 dtype: float64
17th Dec 2022, 1:43 PM
Ankit Gaur
Ankit Gaur - avatar
0
Data science is a multidisciplinary field that involves extracting insights and knowledge from data using various techniques and tools. It combines elements of statistics, mathematics, computer science, and domain expertise to analyze large and complex datasets and make informed decisions. The main goal of data science is to uncover patterns, extract meaningful information, and generate actionable insights from data. This process typically involves several steps, including data collection, data cleaning and preprocessing, exploratory data analysis, modeling and algorithm development, and interpretation of results. Data scientists use a wide range of tools and programming languages, such as Python, R, and SQL, to manipulate and analyze data. They also utilize various statistical and machine learning techniques, such as regression analysis, clustering, classification, and deep learning, to build predictive models and make data-driven decisions. The applications of data science are vast and can be found in numerous industries and sectors. Some common examples include: Business and finance: Data science is used to analyze customer behavior, optimize marketing campaigns, detect fraud, and make investment decisions. Healthcare: https://www.sevenmentor.com/data-science-with-python-training-in-pune.php
30th May 2023, 11:42 AM
mahima mantri
mahima mantri - avatar
0
Data Science is the most powerful approach that combines the principles and practices of mathematics, statistics, artificial intelligence, and computer engineering to analyze large amounts of data. The easiest way to address this question is to first define the term "road map". Roadmaps are strategic plans that define a goal or desired outcome and include important steps or milestones needed to achieve it. Data science is a combination of statistics, mathematics, programming, and problem-solving; finding data in inventive ways; the ability to look at things differently; and data cleaning, preparation, and alignment. Therefore, a data roadmap is a visual representation of a strategic plan designed to help an IT professional learn and succeed in the field of data science. Embark on a transformative journey into the world of data with our Data Science Training In Chennai Whether you're an aspiring data scientist or a seasoned professional looking to enhance your skill set, our hands-on training caters to all levels. https://infycletechnologies.com/data-science-training-in-chennai
8th Dec 2023, 5:33 AM
infycletechnologies