0

OUTPUT DISPLAY- This is the output of my program project and only thing is remaining is that RangeIndex and dtypes values which I can't able to remoe from output display

SOURCE CODE- I are working on python project and narrow down the problem in my code which is below, you can see that between hello1 and hello2 and this the first 20 line of my code.

import sys
import pandas as pd
from sklearn.model_selection import train_test_split
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import mean_squared_error, r2_score
from sklearn.preprocessing import StandardScaler


def train_data():

    # Read data
    data = pd.read_csv("crop_csv_file_csv.csv");
    # Print column names to identify the correct target column name!
    print('hello1');
    data.head();
    data.head();
    data = data[:10000];
    data.head();
    data.info(verbose=False)
    print('hello2');

Following are the things, I tried -

1. data.to_csv(header=None,index=False)
2. data.to_csv(index=False)
3. data = pandas.read_csv('crop_csv_file_csv.csv', header=None)
4. tried to remove all 3 data.head() 

Whenever I tried the above things, no output is displayed and i get a blank display.

9
  • Your question is not complete by any means. You are showing us a browser window from a PHP script. This is not a PHP script. The output you see is from the two print statements and the data.info call. What on earth are you expecting? What do you WANT? data.head does not print anything. Commented Dec 1, 2023 at 19:11
  • And, by the way, Python statements do not use semicolons. That's a bad habit leftover from PHP. Commented Dec 1, 2023 at 19:11
  • @TimRoberts , sorry for incomplete question - i want to remove/ hide that dtypes and rangeindex from output display ( i only want crop yield prediction: ). should i put my whole python script for reference ! Commented Dec 1, 2023 at 19:20
  • THIS code is not printing the "crop yield prediction" line, so we can't tell where that comes from. You can delete everything after the read_csv to get rid of the extra output. Commented Dec 1, 2023 at 19:29
  • @TimRoberts where-ever i tried to delete data.head() to data.info(verbose=False) my system is crashing and whole system became super slow. Commented Dec 1, 2023 at 19:35

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.